Python - Section 5 Practice Tasks

Task One

Ask the user to enter 4 different numbers.

Then randomly select one of those numbers and print it.

Random Numbers

Example solution:

py62.PNG

Task Two

You will make a program for logging into a system.

 

Print a greeting then ask the user for their name.

 

Wait 2 seconds then print “logging in” and the user’s name.

 

Then print the current time (current hour and minute).

Logging In

Example solution:

py63.PNG

Task Three

Random Wait

Generate a random number between 3 and 10.

Print this number then print the current minute and current second.

Wait for the random number you generated then print the current minute and current second again.

Example solution:

py64.PNG

Task Four

Independence Checker

Create a program that displays how many days three specific countries have been independent for. The user will choose either Fiji, Samoa or Australia and the number of days since independence will be displayed.

  • Fiji became independent on 10th October 1970.

  • Samoa became independent on 13th December 1962.

  • Australia became independent on 1st January 1901.

Example solution:

time5.png