Get AI generated coding exercise with your story background:

Build your own exercise with funny/horror/sci-fi/magic story background written by chatGPT.

Design your exercise using keywords or give it a start.
Let AI generate the rest.

Difficulty

Use python to fight zombies. In a small town, a zombie outbreak has occurred and the residents are in danger. You are the only programmer in town and you have been tasked with creating a program to help fight the zombies.

Your program should create a list of weapons that the residents can use to defend themselves. The list should include items such as baseball bats, frying pans, and garden hoes.

Next, your program should create a list of the zombies that have been spotted in the town. The list should include the names of the zombies such as "Zombie Bob" and "Zombie Sue".

Finally, your program should randomly assign a weapon to each resident and randomly assign a zombie to each weapon. This will help the residents know what weapon to use against which zombie.

Remember, the residents are counting on you to save them from the zombie apocalypse. Good luck!

Python

List

Difficulty

Harry Potter comes to the world of Game of Thrones and he is on a mission to collect all the magical items scattered across the Seven Kingdoms. He has a list of all the items he needs to collect but unfortunately, the list is in a jumbled up order.

Harry needs your help to sort the list in alphabetical order. However, there's a catch! The list contains some funny items that Harry and his friends made up as a joke. These items need to be removed from the list before sorting.

Your task is to write a Python program that takes in a list of magical items and removes all the funny items before sorting the list in alphabetical order.

Here's an example of the list of magical items:

magical_items = ["Dragon's Breath", "Phoenix Feather", "Unicorn Horn", "Fairy Dust", "Gillyweed", "Bertie Bott's Every Flavour Beans", "Invisibility Cloak", "Squib's Earwax", "Leprechaun Gold", "Doxy Eggs", "Hippogriff Feather", "Wand of Wishing", "Potion of Love", "Goblin's Snot", "Butterbeer", "Siren's Song", "Basilisk Fang", "Laughing Potion", "Mermaid Tears", "Mandrake Root", "Flobberworm Mucus", "Gillyweed", "Floo Powder", "Squib's Earwax", "Leprechaun Gold", "Doxy Eggs", "Hippogriff Feather", "Wand of Wishing", "Potion of Love", "Goblin's Snot", "Butterbeer", "Siren's Song", "Basilisk Fang", "Laughing Potion", "Mermaid Tears", "Mandrake Root", "Flobberworm Mucus", "Gillyweed", "Floo Powder"]

Your program should remove the funny items "Squib's Earwax" and "Goblin's Snot" from the list before sorting it in alphabetical order.

Hint: You can use Python's built-in list methods to remove items from the list and sort it in alphabetical order.

Python

List

Difficulty

Keywords: Superman, Star Trek. Superman was feeling bored after saving the world yet again. He decided to take a break and watch some Star Trek episodes. As he was watching, he noticed that the episodes were out of order. Being the organized superhero that he is, he decided to write a program to sort the episodes in chronological order.

Using only the knowledge of lists and for loops in Python, help Superman create a program that will sort the episodes of Star Trek in chronological order. The episodes are represented as a list of dictionaries, with each dictionary containing the episode number, title, and air date.

The program should first ask the user for the number of episodes they want to sort. Then, it should ask the user to input the episode number, title, and air date for each episode. After all the episodes have been entered, the program should sort them in chronological order based on the air date.

Finally, the program should print out the sorted list of episodes in the following format:

Episode Number - Title - Air Date

Can you help Superman sort the episodes and save the day once again?

Python

For Loop

AI Tutor

Ask AI anything you would like to know about the exercise.

No need to wait for real human for special question now. AI knows it all.

Have fun in coding challenges. Make your unique story.

Check Demos Course