In this assignment we were to code using code academy and complete the assignment called “Date and Time.” In this assignment we were use the “datetime” library and string that we had learned about in our previous lecture to get the current date. We also changed the order of the date from year/month/day to month/day/year using : print ‘%s/%s/%s’ % (now.month, now.day, now.year) format and print statement. Also we got the time to hour:minute:second using : print ‘%s:%s:%s’ % (now.hour, now.minute , now.second) format and print statement.
While doing this assignment I had no problem. In fact the assignment was quite easy. We used strings and % where “%
operator will fill the %s
paceholders in the string on the left with the strings in the parentheses on the right.” This allowed us to used : and / in time and date.
By : Simran Sandhu