# Saying Hello
Tina's already said hello but you can tell her your name and she'll say hello to you.
First, find the line where Tina says "Why, hello there!"
. Next, change it so that she's saying hello to you. My name is Elliott, so I'd change what she says to "Why, hello Elliott!"
The program you wrote above is great for people that have the same name as you, but what if someone has a different name? We can write a program that asks for your name with the input
function, so that Tina can get it right for anyone's name. Run this program and enter your name:
The input
function is what makes the program ask you for your name. Whatever you type in is then stored in a variable
. Tina uses this variable to remember and then say your name!
We can teach Tina to say anything we want using input
. Can you add input
to this program so that anyone who runs it can tell Tina what to say?
Hint: the say_what
variable is what Tina says in this program. How can we use input
like we did above that the program will ask whoever runs the program what the variable should be?
Thanks to Trinket.io for providing this assignment, part of their Hour of Python (opens new window) course.
← Colors Tina's Pen →