Build a Python Welcome Assistant
Create an interactive Python assistant that greets users and calculates ages.
Introduction
30 Second Summary
Apps ask for your name or age all the time. The response can feel mysterious until you see the few instructions behind it.
In this project, you will build a small welcome assistant with Python in IDLE. Your answers control each response it prints.
What You'll Build
Your saved assistant turns two simple answers into a personalized conversation in the IDLE Shell.
By the end of this project, you'll have:
- A saved interactive Python program you can rerun in IDLE to show a name-based greeting.
- A working age calculation that turns typed digits into a number before showing your age next year.
- A debugging trail where you reproduce a TypeError before repairing the calculation. Different test ages reveal different encouragement after the fix.
- Secret Mission: Give the assistant a puzzle-loving personality with one more question and decision.
Are there any prerequisites?
No coding experience is required.
The first step confirms that IDLE opens with Python 3 before you create your program.
Before We Start
This short step connects the Python welcome assistant to your personal reason for learning how programs respond to people. That purpose gives the hands-on work a clear direction.
Set Up IDLE and Test Python
A welcome assistant needs a reliable place to run Python instructions. Before creating its saved file, you need to confirm that your existing learning environment can execute a simple instruction.
On Windows, IDLE provides a Shell for immediate results. In this step, you will use it to verify Python 3 before opening a separate Editor for saved code.
In this step, get ready to:
- Open IDLE through Windows search.
- Evaluate a basic Shell calculation with Python 3.
- Open a separate untitled Editor window for the assistant.
Open IDLE through Windows search
IDLE starts with a Shell window that runs one instruction at a time. The >>> prompt marks the place for your next instruction.
- Press the Windows key to open Windows search.
- Type IDLE.
- Press Enter to open the installed application.
You'll see IDLE's Shell window with a title bar at the top.
- Confirm that the title bar identifies Python 3.
- Locate the >>> prompt near the bottom of the Shell.
The Shell is where your program's output appears. Runtime errors appear there too.
IDLE Does Not Open?
- Check that you typed IDLE into Windows search.
- Look for an installed IDLE result that identifies Python 3.
Help me check why IDLE is missing or opening with a different Python version.
Test a calculation in the Shell
The Shell evaluates an expression when you press Enter. The + operator adds the two numbers in this test.
- Click immediately after the >>> prompt.
- Type 2 + 2.
- Predict what Python will show before you evaluate the expression.
- Press Enter to evaluate the expression.
You'll see 4 on the next line. Nice work. Your existing IDLE setup can now execute Python instructions.
No Result in the Shell?
- Check that 2 + 2 appears after the >>> prompt.
- Retype the expression if a number or the + operator is missing.
Help me find out why the IDLE Shell is not showing the expected calculation result.
Open the Editor window
The Editor holds the multi-line program you will save in the next step. The Shell remains open to display the program's questions and results.
- Click File in the Shell window's top menu.
- Click New File.
You'll see a separate untitled Editor window. This is the writing space for your welcome assistant.
- Predict which window will still contain the calculation.
- Select the IDLE Shell window from the Windows taskbar.
- Confirm that the window identifies Python 3.
- Confirm that 4 appears directly below 2 + 2.
- Select the untitled Editor window from the Windows taskbar.
You'll finish with the untitled Editor at the front. The Shell remains open with your successful calculation.
Your Python workspace is ready. Next up, you'll make the assistant ask for a name and print a greeting.
Make the Assistant Say Hello
Your Shell calculation proved that Python 3 can execute an instruction. The untitled IDLE Editor from earlier is ready for a program you can save.
A visible greeting turns that empty window into the smallest working version of your welcome assistant.
The assistant stores keyboard input in a variable. It sends the saved value to the Shell as output.
In this step, get ready to:
- Capture a typed name in the name variable.
- Save the two-line program as welcome_assistant.py in Documents.
- Run the module to see a personal greeting in the Shell.
Create the greeting file
The input() function displays the assistant's question. It pauses until someone types an answer.
The name variable stores the returned string. The print() function sends a greeting to the Shell.
- Build the assistant's first conversation by entering this code in the untitled Editor:
name = input("What is your name? ")
print("Hello,", name)
What does this code do?
- The name = input("What is your name? ") line stores the typed answer under name. The variable lets the next line reuse that answer.
- The print("Hello,", name) line sends two values to the Shell. Python places a space between those values in its output.
Saving turns the untitled program into a file that you can reopen. The .py extension identifies it as Python code.
- Click File in the Editor's top menu.
- Select Save As… from the menu.
You'll see the Windows save dialog. This window lets you choose the file's location.
- Select Documents in the save dialog's left panel.
- Enter welcome_assistant.py in the file name field.
The save dialog now points to Documents. It shows welcome_assistant.py as the file name.
- Click Save.
The Editor now displays welcome_assistant.py as the saved file. Your program is ready to run.
Still seeing an untitled file?
- Check the Editor title for welcome_assistant.py.
- Use the save dialog to choose Documents again if the file name is missing.
Help me save welcome_assistant.py correctly in IDLE.
✔️ Awesome, I've got everything!
Your two-line greeting file is saved in Documents.
ⓧ I'd like to double check the full code
name = input("What is your name? ")
print("Hello,", name)
Why these two lines matter
This complete file captures a name before printing the greeting. Matching these two lines keeps the first test focused on one conversation.
Run the welcome assistant
Run Module checks the saved file before execution. It restarts the Shell for a clean run.
Before you run the file, predict what the greeting will reuse from the answer you type.
- Click Run in the Editor's top menu.
- Select Run Module from the menu.
The Shell displays What is your name? and waits for your answer.
- Click the Shell input area.
- Type your name.
- Press Enter.
You'll see Hello, followed by the name you entered. The program has used your input in its output.
Don't see your greeting?
- Click inside the Shell before typing if the question is still waiting for input.
- Compare both lines in welcome_assistant.py with the full-code reference if the Shell reports an error.
Help me troubleshoot why my saved IDLE program is not greeting the name I enter.
That first conversation is working. Your saved assistant now turns a typed name into a personal greeting.
Next, you'll ask for an age. That answer exposes an important difference between text and numbers.
Let the Age Calculation Break
Your welcome assistant can already ask for a name. It can use that answer in a greeting.
Now the assistant needs to ask for an age and calculate next year's value. This first attempt tests how Python handles a typed answer during arithmetic.
In this step, get ready to:
- Add an age question to the assistant.
- Calculate the next-year value from the typed age.
- Run the module to trace Python's response.
Add the age calculation
A variable can keep each answer that someone enters. The IDLE Editor lets you place the age instructions before the greeting output.
- Switch back to the IDLE Editor window containing welcome_assistant.py.
- Find the line containing name = input("What is your name? ").
- Place your cursor at the start of the print("Hello,", name) line.
- Insert the age question plus the calculation above the greeting by copying this code:
age = input("How old are you? ")
next_age = age + 1
What does this code set up?
- The age variable stores the answer from the second input() question.
- The next_age variable asks Python to add 1 to that answer.
- The blank line separates the questions plus calculation from the output statements.
- Find the greeting line containing print("Hello,", name).
- Add the next-year output directly below the greeting by copying this line:
print("Next year, you will be", next_age, "years old.")
What does this output line prepare?
The new print() statement prepares a sentence using the value stored in next_age. The existing greeting remains directly above it.
- Save welcome_assistant.py from the Editor's File menu.
The full-file check below shows the exact program that is ready for its first age test.
✔️ Awesome, I've got everything!
Your saved assistant now contains the age question plus the next-year calculation.
ⓧ I'd like to double check the full code
name = input("What is your name? ")
age = input("How old are you? ")
next_age = age + 1
print("Hello,", name)
print("Next year, you will be", next_age, "years old.")
How should the file be arranged?
The questions plus calculation come first. The greeting plus next-year sentence form the output section below the blank line.
Run the first calculation
Running the module tests each instruction in order. The Shell shows how far Python gets with the typed age.
Before you run the module, which lines do you expect Python to reach? Keep that prediction in mind.
- Select Run from the Editor's top menu.
- Select Run Module.
- Type your name at the first question in the Shell.
- Press Enter.
- Type a whole-number age such as 20 at the second question.
- Press Enter.
You'll see the Shell display questions for your name plus age. The run then stops with a traceback ending in TypeError.
The next-year sentence never appears. This is the intended shortfall in the first calculation.
You have successfully made the hidden mismatch visible. Python has given you a precise place to investigate.
How does a traceback help?
A traceback shows the route to the instruction where execution stopped. Its last line names the runtime error that occurred.
- Read the last line of the traceback in the Shell.
- Find the highlighted calculation next_age = age + 1 in the traceback.
Why did Python stop?
The input() function returns a string. The age variable therefore holds text.
The value 1 is an integer. Python cannot apply + between these two value types in this calculation.
Not seeing the expected TypeError?
- Save welcome_assistant.py before running the module again.
- Compare every line with the full-code reference above if the Shell reports a syntax problem.
- Confirm that the highlighted calculation reads next_age = age + 1.
Help me compare my program with the expected first attempt.
You found the exact calculation that stops the assistant. Next up, you'll change how the typed age is stored so the arithmetic can finish.
Turn Text into a Number
The last run reached the age calculation in IDLE. It stopped with a TypeError because Python tried to add 1 to the string returned by input().
This step converts the age into an integer before the calculation. The same test can then reach the next-year sentence.
In this step, get ready to:
- Convert the age response into an integer with int().
- Save the repaired welcome_assistant.py file.
- Verify that age 20 produces next year's age without the earlier error.
Convert the age input
The int() function builds an integer from digit text. Wrapping the age question with int() gives age + 1 two numbers to add.
- Switch back to the Editor window from earlier.
- In welcome_assistant.py, find age = input("How old are you? ").
- Copy the following replacement over that line:
age = int(input("How old are you? "))
What does this change do?
- The input() function asks the age question.
- The int() function converts the returned digit string before assigning it to age.
- The next_age = age + 1 calculation can now add two numbers.
Save the repaired file
- Click File in the Editor window's top menu.
- Click Save to update welcome_assistant.py in Documents.
✔️ Awesome, I've got everything!
Your saved file now converts the age before calculating next year's value.
ⓧ I'd like to double check the full code
This is the complete file at this point.
name = input("What is your name? ")
age = int(input("How old are you? "))
next_age = age + 1
print("Hello,", name)
print("Next year, you will be", next_age, "years old.")
What should match?
The age assignment is the single repaired line. It converts the response before next_age runs.
Run the repaired assistant
Using the same whole-number age tests the path that failed earlier. This gives you a direct before-and-after comparison.
Before you run the module again, do you expect it to stop at next_age = age + 1 or reach the next-year sentence?
- Click Run in the Editor window's top menu.
- Click Run Module.
- Click the Shell window if the name prompt does not have focus.
- Type your name at the name prompt.
- Press Enter.
- Type 20 at the age prompt.
- Press Enter.
You'll see Hello, followed by the name you entered. Below it, you'll see Next year, you will be 21 years old..
That's the calculation repaired: your assistant now turns age 20 into next year's age 21.
Still seeing the TypeError?
- Check that int( appears directly before input( on the age line.
- Check that the age line ends with )).
- Save welcome_assistant.py again before rerunning the module.
Help me repair the age conversion in my welcome assistant.
Your assistant can now calculate with the age it receives. Next, you'll make its final message change for different age groups.
Add Age-Based Encouragement
Your repaired assistant already runs in IDLE. It calculates next year's age correctly.
The assistant still gives every learner the same response. Conditional branches in Python let it choose an encouragement from the entered age.
In this step, get ready to:
- Add an age check with three conditional branches.
- Use four-space indentation for each encouragement.
- Run the assistant with two ages to confirm its response changes in the Shell.
Add the age decision
A comparison gives each branch a yes-or-no test. Python checks the branches from top to bottom.
- Switch back to the Editor window containing welcome_assistant.py.
- Place your cursor on a blank line below print("Next year, you will be", next_age, "years old.").
- Add the complete age decision by copying the code below:
if age < 13:
print("You are getting an early start with Python.")
elif age < 20:
print("You are building a useful skill as a teenager.")
else:
print("It is never too late to learn Python.")
How do the branches work?
- The if age < 13: branch checks the youngest age range first.
- The elif age < 20: branch runs its comparison when the first comparison is false.
- The else: branch handles every remaining age.
- Four spaces place each print statement inside its branch.
- Python runs exactly one matching branch during each test.
- Select File in the Editor's top menu.
- Select Save.
Before this first test, what branch do you expect age 12 to reach.
- Select Run in the Editor's top menu.
- Select Run Module.
- Type your name at the name question.
- Press Enter.
- Type 12 at the age question.
- Press Enter.
There it is: you'll see You are getting an early start with Python. after the next-year sentence. The other encouragements stay out of this run.
Conditional Not Running?
- Check that if age < 13: ends with a colon.
- Check that elif age < 20: ends with a colon.
- Check that else: ends with a colon.
- Make sure each print statement begins with four spaces.
Help me check my age decision.
The complete core file should now contain the greeting logic plus all three age branches.
✔️ Awesome, I've got everything!
Your saved welcome_assistant.py file now contains the complete age decision.
ⓧ I'd like to double check the full code
name = input("What is your name? ")
age = int(input("How old are you? "))
next_age = age + 1
print("Hello,", name)
print("Next year, you will be", next_age, "years old.")
if age < 13:
print("You are getting an early start with Python.")
elif age < 20:
print("You are building a useful skill as a teenager.")
else:
print("It is never too late to learn Python.")
Compare the two age paths
The first run proved that age 12 selects the first branch. A second run with age 20 checks the final branch.
Before this run, what message do you expect age 20 to select.
- Select Run in the Editor's top menu.
- Select Run Module.
- Type your name at the name question.
- Press Enter.
- Type 20 at the age question.
- Press Enter.
You'll see It is never too late to learn Python. after the next-year sentence. The early-start message stays out of this run.
That is the core assistant complete: one entered age now selects one matching encouragement.
Secret mission
Add a Puzzle Personality
Your assistant already responds to age. Extend it with a puzzle question that handles lowercase and capitalized answers before choosing a matching final message.
Clean Up Your Resources
Clean Up Your Resources
Choose whether to keep your local assistant ready, pause your editing session, or delete the saved program. This project runs entirely on your Windows 10 computer with no ongoing costs.
Resources you used:
- The welcome_assistant.py file saved in your Documents folder.
- The open IDLE Editor window.
- The open IDLE Shell window.
Keep everything running
No action is needed. Choose this if you want to keep editing or demonstrating your welcome assistant.
- Keep welcome_assistant.py in your Documents folder.
- Leave IDLE open while you are actively editing the assistant.
- Rerun the saved program whenever you want to test another name, age, or puzzle answer.
Pause - I'll come back to this later
Close IDLE to pause your editing session. Your saved program stays in Documents for your next session.
- Close the IDLE Editor window by selecting the close control in its top-right corner.
- Close the IDLE Shell window by selecting the close control in its top-right corner.
- Confirm that both IDLE windows are closed.
Your welcome_assistant.py file remains ready to reopen later.
Delete - I don't want to use this again
Permanent deletion removes the program from your computer. Choose this option only when you no longer want to keep your welcome assistant.
- Close the IDLE Editor window by selecting the close control in its top-right corner.
- Close the IDLE Shell window by selecting the close control in its top-right corner.
- Press the Windows key to open search.
- Type Documents into the search field.
- Select the Documents folder from the search results.
- Select welcome_assistant.py in the file list.
- Hold Shift while pressing Delete to permanently delete the file.
- Confirm the deletion when Windows asks for approval.
You should no longer see welcome_assistant.py in your Documents folder.
Nice Work!
Nice Work!
You made it! Your saved Python welcome assistant now turns each person's answers into a personalized conversation.
What you learned:
- Built a saved Python program in IDLE as welcome_assistant.py. Used input() plus variables to remember answers before print() displayed the greeting.
- Reproduced a runtime error when age remained text. Repaired it by converting age with int(). Used arithmetic to calculate next_age.
- Built conditional branches with if, elif, and else. Confirmed that only one age-based response prints during each run.
- Secret Mission: Added a puzzle personality with a second input. Normalized capitalized answers through .lower() before choosing the final response.
Ready to quiz yourself?