Hello, Python
Your first prints, variables, and user input
What you'll learn
- Run your first Python program
- Display text and numbers with print
- Ask the user for input and personalize output
- Build a small welcome message project
Lesson & examples
Read the code, then the explanation — try changing values before the project.
print("Hello, Python World!")
print("The number is", 4)
print("2 + 2 =", 3 + 2)print() sends text to the screen. You can pass several values separated by commas — Python adds spaces between them.
- print("Hello, Python World!")
A string in quotes is printed exactly as written.
- print("The number is", 4)
Mixing text and a number in one print — no need to convert 4 to a string.
name = "Vivian"
print(f"Hello, {name}! Welcome to Python Programming")f-strings let you embed variables inside text with curly braces.
- name = "Vivian"
Stores text in a variable for reuse.
- f"Hello, {name}!"
The f before the quotes means: insert the value of name here.
userName = input("What is your name? ")
print(f"Hello, {userName}! Welcome to Python Programming")input() pauses the program and waits for the user to type. It always returns a string.
- input(...)
Whatever the user types is saved into userName.
