Description
In the following lab which is Lab 3 Date and Time i will write a report of using code academy to do a lab using that reference (website) and below ill then show you the coding of this lab and explain deeply what this lab is clearly about and how they function to give a result and right now the result that we need to accomplish is typing out a string to set the current date and current time as in one whole string. This lab had to use knowledge also with string section 3 with python towards the end of date and time strings and also advanced printing was involved so yes strings section was vital to understand to accomplish this lab and coming to conclusion this was probably one of the easier labs, cause it was short and not that much thinking had to be used just basic thinking of python.
Code
This code shows us the following information of what i just did for this lab using code academy i figured out that in this section of code academy we have to figure out how to type the date and current time as of now or it can be any random time typed down. In this code we will start of with from datetime to IMPORT datetime to set up the datetime and the next line we conclude with now = datetime.now() followed by print(now). First things first in order to write the current date format as of mm/dd/yyyy we have to type print now.month, now.day, now.year as well to make the format perfect, this is for the date. For the current time its also similar but you have to write “current” on all as starting off first with “current_hour = now.hour” next is now.minute then now.second to make the format hh:mm:ss perfect. Finally we must make a “string” to type both the current date and as well as the current time and as you see below you see that its tied as a whole string to conclude the date and time. And this is the final result of Lab 3 Date and Time. Screenshot to be shown below…
from datetime import datetime now = datetime.now() print(now) print now.month print now.day print now.year current_hour = now.hour current_minute = now.minute current_second = now.second print ("10" "/" + "09" "/" + "2013" " " "10" ":" + "09" ":" + "09")
Screenshot
This is the screenshot of the final result of the lab 3 date and time, as you see it shows a lot of information and from that we will see that below is the result for this lab that i just completed. To actually complete the actual screenshot i had to use code academy to get the screenshot next i printscreen then paste it to paint then insert it to the lab page and that is how i got my screenshot for this lab. And as you can see the screenshot shows the final result of this lab which is Lab 3 Date and Time and of course this lab was accomplished using Code Academy.