Exercise: Input User Information
In this exercise, we will have the user enter their information and output it in a certain format.
This exercise expands upon the Print Values exercise from before. This time, we’re only going to get 2 values from the user. The first is their name and the second is their age.
Task
- Create a
namevariable that simply asks the user to input their name. - Create an
agevariable that asks the user to input their age. - Print out the variables with the following format:
Hello {name}
I see that you are {age} years old!
Where {name} and {age} are the values from your input.
Example output
Enter your name: Edward
Enter your age: 25
Hello Edward
I see that you are 25 years old!