Context: Create a tool to build and rate a team of gamers.
Includes: class/object, loop, list, dict, function, return, input, int, str, if/elif/else, try/except, concatenation
Steps:
Define a Player class with name, role, and score as attributes.
Ask how many players to add.
Use a loop to create and store Player objects in a list (use input + try/except).
Create a function to return a performance label based on score.
Loop through the list and print name + rating.
Context: Create a playlist and classify it based on length.
Includes: class/object, loop, list, dict, function, return, input, str, float, if/elif/else, try/except, concatenation
Steps:
Define a Song class with name and duration.
Ask how many songs to add.
Loop to create Song objects with input + try/except, store in a list.
Function to calculate total duration and return playlist type.
Print song list and summary.
Context: Track daily exercise and provide weekly feedback.
Includes: class/object, loop, list, dict, function, return, input, int, if/elif/else, try/except, concatenation
Steps:
Create an ExerciseDay class with day name and minutes.
Loop to get 5 daysโ data with input + try/except.
Store objects in a list.
Function to total minutes and return a feedback message.
Print each day and final comment.
Context: Build a pizza menu and total the order.
Includes: class/object, loop, list, dict, function, return, input, float, if/elif/else, try/except, concatenation
Steps:
Define a Pizza class with name and price.
Input 3 pizzas with loop + try/except, store objects in a list.
Function to calculate order total and return message.
Use if/elif/else to give a comment (e.g. โBig order!โ).
Show full summary with string output.
Context: Users build a garage of dream cars.
Includes: class/object, loop, list, dict, function, return, input, int, float, if/elif/else, try/except, concatenation
Steps:
Define a Car class with brand, speed, and cost.
Input 3 cars using try/except.
Store objects in a list.
Function returns a performance label based on speed.
Loop to print each carโs rating.
Context: Track subject hours and give feedback.
Includes: class/object, loop, list, dict, function, return, input, int, if/elif/else, try/except, concatenation
Steps:
Create a Subject class with name and hours/week.
Input 5 subjects with try/except.
Store in a list.
Function totals hours and returns a workload rating.
Print the subject list and feedback.
Context: Recommend movies based on genres.
Includes: class/object, loop, list, dict, function, return, input, str, if/elif/else, try/except, concatenation
Steps:
Define a Friend class with name and favourite genre.
Ask how many friends are coming.
Input friend info and store as objects.
Function recommends a movie based on genre (with default case).
Print each name + movie using string output.
Context: Create and sort recipes by cook time.
Includes: class/object, loop, list, dict, function, return, input, int, float, if/elif/else, try/except, concatenation
Steps:
Define a Recipe class with name, ingredients count, and cook time.
Input 3 recipes with try/except.
Store in a list.
Function returns a label (Quick, Medium, Long) based on time.
Print recipe info and label.
Context: Help plan posts and give timing advice.
Includes: class/object, loop, list, dict, function, return, input, int, if/elif/else, try/except, concatenation
Steps:
Define a Post class with type and hour.
Input multiple posts using try/except.
Store in a list.
Function returns timing advice (early, prime time, late).
Print each post with feedback.
Context: Track scores and rank players.
Includes: class/object, loop, list, dict, function, return, input, int, if/elif/else, try/except, concatenation
Steps:
Create a TournamentPlayer class with name and score.
Input 4 players using try/except.
Store in a list.
Function ranks performance and returns a message.
Loop to print name + result.