Introduction
This challenge focuses on creating a simple Python script that takes user input and produces formatted output. The exercise reinforces fundamental Python concepts including user input handling and string formatting.
🧑💻 New to Python or LabEx? We recommend starting with the Quick Start with Python course.
Interactive Python Script
The code editor on the left side of your screen will show the template file hello_python.py. You can click on the file to open it and write your code where you see the TODO comments.
Tasks
- Complete the Python script by replacing the
TODOcomments with working code - Test your script by running it in the terminal
Requirements
- Work with the template file
/home/labex/project/hello_python.py - Replace the first
TODOcomment with code that:- Uses the
input()function - Shows the prompt text
Enter your name: - Stores the result in a variable named
name
- Uses the
- Replace the second
TODOcomment with code that:- Uses the
print()function - Outputs the message
Hello Python, I am <name>! - Replaces
<name>with the stored input value - Includes the exclamation mark at the end
- Uses the
Working with the Editor
- Click on the file
hello_python.pyin the file explorer on the left to open it - The editor provides features like:
- Syntax highlighting for Python code
- Auto-indentation
- Line numbers for easy reference
- After editing:
- Save your changes using Ctrl+S (Cmd+S on Mac)
- Run your script in the terminal using
python hello_python.py

Example
When running the completed script:
$ python hello_python.py
Enter your name: Alice
Hello Python, I am Alice!
Summary
In this challenge, you have worked with a Python script template to create an interactive program. The exercise introduced you to essential programming concepts including working with code editors, handling user input with input(), and creating output with print(). You also learned how to run Python scripts from the terminal and saw how template files can help structure your code.



