In this small project, we'll create a program that experiments with Python's ability to give us the current date and time. This will give you some practice with printing strings, concatenation, and the str()
explicit conversion function.
At the end of this section, you'll know how to print the date and time in the following format: mm/dd/yyyy hh:mm:ss
.
from datetime import datetime
On line 1, notice the statement from datetime import datetime
. Importing special functionality into your programs will be covered in Unit 4's discussion of the import statement.
For now, just know that we're telling the Python interpreter to give our program the ability to retrieve the current date and time.
In the next exercise, we'll cover how to explicitly retrieve this information!