summaryrefslogtreecommitdiff
path: root/misc/factoralLog.py
diff options
context:
space:
mode:
authormlot <petri-rush-curvy@duck.com>2025-06-06 13:40:57 -0400
committermlot <petri-rush-curvy@duck.com>2025-06-06 13:40:57 -0400
commit75a42ec54dbf721caa659ddf02c1f46fc2cb4bef (patch)
tree84be794a2481e356a7784557a6f9fb6fbf29cfdd /misc/factoralLog.py
initial commit for archivingHEADmain
Diffstat (limited to 'misc/factoralLog.py')
-rw-r--r--misc/factoralLog.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/misc/factoralLog.py b/misc/factoralLog.py
new file mode 100644
index 0000000..c082423
--- /dev/null
+++ b/misc/factoralLog.py
@@ -0,0 +1,19 @@
+#!python3
+
+# Chapter 10 Factoral Log
+
+import logging
+logging.basicConfig(filename='errorLog.txt', level=logging.DEBUG, format=' %(asctime)s - %(levelname)s - %(message)s')
+logging.debug('Start of Program')
+
+def factorial(n):
+ logging.debug('Start of Factorial(%s%%)' % (n))
+ total = 1
+ for i in range(1, n + 1):
+ total *= i
+ logging.debug('i is ' + str(i) + ', total is ' + str(total))
+ logging.debug('End of Factorial(%s%%)' % (n))
+ return total
+
+print(factorial(5))
+logging.debug('End of Program')