In this chapter, you’ve learned to write conditional tests, which allow you to check any condition of interest. You’ve also learned to write simple if statements, and how to create a more complex series of if statements to identify when the exact conditions you want are present. You should also be able to apply this concept to lists, and write for loops that handle most items in a list one way but handles certain items with specific values in a different way.
Overview:
Welcome to Panem, where every tribute is sorted into their district based on their skills and potential. Effie Trinket has asked for your help! Tributes have completed their evaluation, and it's your job to assign them to their districts. The higher their score, the more prestigious their district. Will you find the next victor from District 1, or perhaps a hidden gem from District 12? Let's find out which district matches their talents!
Prompt the user to enter their score (integer between 1 and 100) and assign them a district based on the following:
Score 1-25: District 12
Score 26-50: District 7
Score 51-75: District 4
Score 76-100: District 1
Prompt a user to tell you how many participants they'll enter
Enter a name and score for each participant
Once you're done entering the information, display the people, scores, and which district they're assigned to
Spider-Man is in trouble! Villains from across the multiverse are popping up in New York City, and Peter needs to figure out which universe they belong to before they wreak havoc. You’ll act as Spidey’s trusted multiverse analyst. When you select a villain, your program will identify their universe and help Spidey prepare for the battle ahead. Can you help Spider-Man keep the multiverse in balance? Suit up, and let’s catch some bad guys!
Prompt the user to enter villain names (one at a time) into a list. Collect up to 5 villains.
Each time, ask the user if the villain is a threat (yes/no).
Ask the user to assign a power level to each villain (on a scale of 1-10).
Loop through the list of villains and:
If the villain’s power level is above 7 and they are a threat, print a warning.
If the villain is a threat but has a power level above 5, mark them as "potentially dangerous."
For all others, print "Not a priority."
Print out which Universe the villain belongs to
Green Goblin: Earth-616
Electro: Earth-1610
Doc Ock: Earth-199999
Sandman: Earth-12041
After processing all villains:
Count how many villains are "major threats."
Count how many are "potentially dangerous."
Print a final status report for Spider-Man.
This task is quite involved and may take you more than 1 class. It is an automatic 300% on your quiz if you do this one and get it running like it should. If, additionally, you format it nicely with tables, unicode, etc, you'll get 25% more
Who you gonna call? The Ghostbusters! But even the Ghostbusters need help figuring out what kind of ghost they’re dealing with. Is it Slimer, leaving a trail of ectoplasm? Could it be Muncher, causing chaos with its glowing appetite? Or maybe it’s a malevolent spirit like Zuul! You’re in charge of the new ghost identification system. Based on some spooky clues, you’ll determine the type of ghost haunting Summerville. Grab your proton pack and get ready to save the day—don’t cross the streams!
NOTE: You will need to use the random library as well as random.randint(LOW, HIGH)
Identify Ghosts:
You need to make 3 ghost capture attempts...
You will be prompted to enter details about a ghost haunting Summerville:
Is the ghost slimy? (yes or no)
Does it fly? (yes or no)
Is it glowing? (yes or no)
Based on these details, determine the ghost’s identity. For example:
Slimy + Flying + Glowing = Slimer
Slimy + Not Flying + Glowing = Muncher
Not Slimy + Flying + Glowing = Zuul
Other combinations may result in an unknown ghost or a regular ghost.
Attempt Capture:
A random system will determine whether the ghost is captured:
Get a number from 1 -10
Slimer can be captured with a 3 or higher
Muncher can be captured with a 5 or higher
Zuul needs a 9 or 10
Regular Ghosts can be captured with a 2 or higher
If successful, the ghost will be added to the containment unit.
If unsuccessful, the ghost escapes!
Manage the Containment Unit:
You can put them into the containment unit, which will keep track of which ghosts you've collected, and a running total of how many ghosts you have.
Track Progress:
Keep track of how many ghosts you catch as well as how many tries it took.
Keep track of which types of ghosts you captured
After every ghost, you’ll see:
How many ghosts are in the containment unit.
The current status of the ghost you just encountered (captured or escaped).
Win or Lose:
Print a summary of your success, including:
Total ghosts captured.
Total ghosts escaped.
BONUS: Display the ghost catches in a table, and show your capture success rate as a percentage.