EXERCISE 2: Fetch and save user input

Task: Ask the user for their name using input() and greet them personally. Replace your hard-coded name value and instead ask the user for their name. Then print out the greeting with the value they enter.

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 request for their name, e.g.

Welcome to my learning app!
What is your name?

Then when you enter your name, e.g. Alex, and press enter, you should see a welcome message with this name, e.g.:

Hello Alex!
Scratch pad

Use this space to try out ideas as you develop your code.

# Write code and try it out here

You can copy and paste things that work into your flashcards_app.py file

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 2: Fetch and save user input” 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
name = input("What is your name? ") # Fetch from user and save to variable
max_cards = 20

# Using f-strings 
print(f"My name is {name}")
print(f"I want to practice at most {max_cards} cards per session")

Take a break: 🍵