Date and Time

In this exercise we worked with creating and manipulating variables to return a string, which is basically a sentence or statement. One resource that was heavily implemented was the use of “%s” as a placeholder for a variable or multiple variables. What this means is that you can write a sentence in an ad lib form, or fill in the blanks, and then later create variables to fill in those blanks. The best representation of this is in the last picture below. The “%s” symbol serves as a placeholder for variables but will follow the order in which you place them, meaning that wherever you write the first “%s”, will use the first variable you have written. For this exercise we were tasked with writing code that returned the current date and time, however we had to make sure they were returned in the correct formats, mm/dd/yyyy and hh:mm:ss.

 

dt1

dt3

dt4

dt5

dt6