1.
Input Function and F-String Basics
Scenario:
You are creating a user registration form for a website. The form asks for the user's first
name, last name, and age. After collecting this information, the system should display a
welcome message using f-strings.
Question:
Write a Python program that:
Takes the user's first name, last name, and age as input.
Displays a welcome message in the format: "Welcome, [First Name] [Last Name]!
You are [Age] years old."
2. List and Input Function
Scenario:
A teacher wants to collect the names of five students and store them in a list. After all the
names are entered, the program should display the list of students in alphabetical order
using an f-string.
Question:
Write a Python program that:
Collects five student names using a loop.
Stores the names in a list.
Displays the names in alphabetical order using f-strings.
3. Dictionary and Input Validation
Scenario:
A shopping app collects product names and their prices from the user. If the user enters a
negative price, the program should display an error message and ask for the input again.
Finally, the app should display the products and their prices using f-strings.
Question:
Write a Python program that:
Uses a dictionary to store product names as keys and prices as values.
Takes input for the product name and price using a loop.
Validates that the price is not negative. If it is, display an error and ask again.
Displays the products and their prices using f-strings.
4. Tuple and Conditional Display
Scenario:
You are designing a system that keeps track of a user's favorite books. The user can enter
the names of three books, which are stored in a tuple. If the user enters the same name
twice, display a warning message. Otherwise, print the list of favorite books using an f-
string.
Question:
Write a Python program that:
Collects three book names and stores them in a tuple.
Checks if there are any duplicate book names.
If duplicates are found, displays a warning.
If no duplicates, displays the books using an f-string.
5. Set and Input Uniqueness
Scenario:
A company wants to collect the email addresses of its employees to send out a newsletter.
The system should ensure that each email address is unique. If a duplicate is entered, it
should display a message and ignore the duplicate. Finally, it should display the list of
unique email addresses.
Question:
Write a Python program that:
Collects email addresses and stores them in a set to ensure uniqueness.
If a duplicate is entered, displays a message and ignores it.
Displays all unique email addresses using an f-string.