Some useful snippets
There are always lots of ways of doing the same thing. Go to http://docs.python.org/3.3/library/time.html and have a look at this module. It contains some useful things.
Q1. Type in this code and get it working:
import time
print("Hello")
time.sleep(3)
print("Goodbye")
What does it do?
Q2. Write a program that:
displays '2 + 2 =' and then a 3 second wait should happen and then
'Wait for it. Wait for it ....' should be displayed and then a further delay of 3 seconds should happen and then
'4' should be displayed.
Q3. Ask a user how long they want to wait for, and then wait for that number of seconds before displaying 'Finished'.
Q4. There is a useful module called calendar that do a lot of interesting things. Look up the Python documentation here: http://docs.python.org/3.3/library/calendar.html You will need to refer to it for some of the following questions.
Q5. Type in this code and get it working:
cal = calendar.month(1791, 12)
print ("Here is the calendar for December 1791, when Charles Babbage was born.\n")
print (cal);
Describe what gets printed out. Who was Charles Babbage?
Q6. Print out the month that you were born in.
Q7. Use the Python documentation. Print out the calendar for the whole year that you were born in.
Q8. In the weekday method, what number represents Monday?
Q9. Use the weekday method to find the day (Monday, Tuesday etc) you were born on.
Q10. Explore some of the other methods in the calendar module. Try some of them out.