Python Programming Activities
Python Programming Activities
1. You are trying to log in to your old computer, and can't remember the
password. You sit for hours making random guesses... I'm sure you thought it was
funny back when you came up with that password (chEEzburg3rz).
Write a program that tells you whether your guess is correct. If it is correct, it should
grant access like this:
Enter password: chEEzburg3rz
Access granted
2. Write a program to tell you which method of transport to use for your next outing.
The first step in this decision is based on the weather. If it is currently raining, you
should take the bus.
If it is not currently raining, your method of transport should be determined by the
distance you need to travel. If the distance is greater than 10km, you should take the
bus. If it is between 2km and 10km (inclusive), you should ride your bike, and if it less
than 2km, you should walk. The distance should always be a whole number.
Your program should only ask for the distance if it is relevant to the answer. That is, if
it is raining, it shouldn't ask you how far you need to travel.
Is it currently raining? No
How far in km do you need to travel? 1
You should walk.
3. Write a program that works out whether your bank balance is in the red.
If the number of dollars is zero or positive it should work like this:
Number: 50
In the black :)
But when your balance goes negative, your program should work like this:
Number: -1
In the red :(
4. In July 2011, the final NASA Space Shuttle mission launched from the
Kennedy Space Center. Write a program to run the countdown sequence
for the shuttle launch. Your program should work like this:
Time to launch: 10
Counting down ...
10 ...
9 ...
8 ...
7 ...
6 ...
5 ...
4 ...
3 ...
2 ...
1 ...
Lift Off!
5. You are learning a new language and are having a competition to see how
many unique words you know in it to test your vocabulary learning.
Write a program where you can enter one word at a time and be told how
many unique words you have entered. You should not count duplicates.
The program should stop asking for more words when you enter a blank
line.
Word: Chat
Word: Chien
Word: Chat
Word: Escargot
Word:
You know 3 unique word(s)!
6. Write a program that takes a list of student names and sorts them
to create a class roll. The list of names will be given on a one line
separated by a single space.