0% found this document useful (0 votes)
83 views3 pages

Python Programming Activities

1. This document outlines 8 Python programming activities of varying complexities that involve concepts like user input, conditionals, loops, lists, sorting, and games. The activities include password validation, transportation recommendation based on weather and distance, checking bank balance, countdown timers, word counting, student name sorting, Rock-Paper-Scissors, and number guessing.

Uploaded by

Jordan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views3 pages

Python Programming Activities

1. This document outlines 8 Python programming activities of varying complexities that involve concepts like user input, conditionals, loops, lists, sorting, and games. The activities include password validation, transportation recommendation based on weather and distance, checking bank balance, countdown timers, word counting, student name sorting, Rock-Paper-Scissors, and number guessing.

Uploaded by

Jordan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

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

If your guess is incorrect it should deny access like this:


Enter password: lolcatZ
Access denied

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? Yes


You should take the bus.
 
 Is it currently raining? No
How far in km do you need to travel? 8
You should ride your bike.

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.

Students: Peng Ivan Alan Jodi Macy


7. Make a two-player Rock-Paper-Scissors game. (Hint: Ask for
player plays (using  input), compare them, print out a message of
congratulations to the winner, and ask if the players want to start
a new game)

Remember the rules:


 Rock beats scissors
 Scissors beats paper
 Paper beats rock

8.Generate a random number between 1 and 9 (including 1 and


9). Ask the user to guess the number, then tell them whether
they guessed too low, too high, or exactly right.
(_Hint: remember to use the user input )

 Keep the game going until the user types “exit”


 Keep track of how many guesses the user has taken, and when the
game ends, print this out.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy