Lab 3

Date and Time

This lab consisted of us learning how to use python to figure out the date and time. The parameters of the program was pretty easy to understand. However I still ran into some problems while writing my code. One of the first problem i encountered was inputting the symbol %s correctly. The final problem that I ran into  while writing the code was my spelling. Which i did not realize until my professor pointed out to me. After these two hurtles it was smooth sailing. Down below you can see the final code that i wrote. The purpose of this code is to make python show the month, day, then year. Afterwards in that same line it show the hour, minute, and the seconds.. When you run the program it shows you today’s date and time. After the code you can a picture of my end result.

from datetime import datetime
now = datetime.now()
print(“%s/%s/%s %s:%s:%s”%(now.month, now.day, now.year, now.hour, now.minute, now.second))

as

Leave a Reply

Your email address will not be published. Required fields are marked *