Python Beginner Concepts Tutorial

Intro Logger Module

Downsides of using the print() function in a Python program: - Cannot easily see when (date and time) the code was executed. - Cannot easily identify the line number the print function was executed. - Cannot easily identify the Python script in which the print function was executed. (Multiple Python scripts can be utilized in a Python program.) - Cannot easily identify the Python function in which this statement was executed - Cannot easily toggle the execution of print statements. Let's say you had a 200 line Python script with 30 print statements, another person examining your code may just want to print a select few statements to debug your coe - perhaps just 5 of your 30 total statements.

Example: Merge Two Pre-Sorted Lists to Create One Sorted List

To solve this problem, we will not use the built-in Python sorted() function.

# merge two sorted lists without using a built-in Python function
print("The answer is", 2*2)
The answer is 4