The Hello User Program
This is a mini-program and is presented to help you understand a concept. This is a very simple program that asks the user to input their name and their age.
It then says hello back to the user.
You will need to create a new file and paste this in to have a play.
name = input("Hello, what is your name?\n")
age = input("What is your age?\n")
print(f"Hello {name}, your age is {age}.")
Key Takeaways
We see 3 things here that are of interest:
- The
input()
function. This asks the user for some input via the terminal. - We assign (
=
) the input to a variable (name
andage
) - We print back out to the user using an f-string.
The next lesson on Simple I/O (Input/Output) will explain these in more detail.