EXERCISE 1: Store user details in variables
Task 1: Create variables to store your name and the maximum number of cards you want to practice each session. Choose sensible names for these variables (e.g. name, max_cards) and initialise each of them with a value of the appropriate data type.
- What data type should the variable name be?
- What data type should the variable max_cards be?
Task 2: Use the + operator to display your name after the string “My name is “, e.g.
My name is Alex Ubuntu
Task 3: Use the , separator to display the maximum number of cards you want to practice per session, e.g.
I want to practice at most 20 cards per session.
Task 4: Rewrite the code you wrote in Task 2 and Task 3 with f-string syntax
Run and check: Run your code in the terminal to make sure it works with the command
$ python flashcards_app.py
You should see your welcome message along with the strings displaying your name, age and first language, e.g.
Welcome to my learning app!
My name is Alex Ubuntu.
I want to practice at most 20 cards per session.
Read through and add comments: Add any comments in your code that will help you understand it when you come back to it later.
Save your progress: Commit with a descriptive message, e.g. “EXERCISE 1: Store user details in variables” and save your work to Github with the standard Git workflow.
(Re)read the guides:
Example solution
flashcards_app.py
# Created by: Alex Ubuntu
# Date: 01.01.2026
# Purpose: A personal flashcard trainer to help with learning
# Welcome message
print("Welcome to your personal flashcard trainer!")
# Variables (Task 1)
name = "Alex Ubuntu"
max_cards = 20
# With + operator (Task 2)
# Need to add spaces explicitly
print("My name is " + name)
# With , operator (Task 3)
# Spaces already included by default
print("I want to practice at most", max_cards, "cards per session")
With f-strings (Task 4):
# Created by: Alex Ubuntu
# Date: 01.01.2026
# Purpose: A personal flashcard trainer to help with learning
# Welcome message
print("Welcome to your personal flashcard trainer!")
# Variables (Task 1)
name = "Alex Ubuntu"
max_cards = 20
# Using f-strings (Task 4)
print(f"My name is {name}")
print(f"I want to practice at most {max_cards} cards per session")
Take a break: 🧘
