0
0
Pythonprogramming~15 mins

Taking input using input() in Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Taking input using input()
📖 Scenario: You are creating a simple program that asks a user for their name and age to greet them personally.
🎯 Goal: Build a program that takes a user's name and age as input and then prints a greeting message including their name and age.
📋 What You'll Learn
Use input() to get user input
Store the input in variables named name and age
Print a greeting message using the input values
💡 Why This Matters
🌍 Real World
Taking input from users is common in programs like forms, quizzes, and interactive tools.
💼 Career
Understanding how to get user input is a basic skill for many programming jobs, including web development and data entry applications.
Progress0 / 4 steps
1
Create variables to store user input
Create a variable called name and use input() to ask the user: "Enter your name:"
Python
Need a hint?

Use input() with the prompt inside the parentheses and quotes.

2
Create a variable to store age input
Create a variable called age and use input() to ask the user: "Enter your age:"
Python
Need a hint?

Use input() again with the prompt "Enter your age:".

3
Create a greeting message using the inputs
Create a variable called greeting that uses an f-string to combine name and age into this message: "Hello, {name}! You are {age} years old."
Python
Need a hint?

Use an f-string by putting f before the quotes and curly braces around variables.

4
Print the greeting message
Use print() to display the greeting variable.
Python
Need a hint?

Use print(greeting) to show the message on the screen.