Python Forum

Full Version: Crash Course Chapter 7
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I attempting to complete python crash course. A concern is the understanding of the work. For instance in chapter 7,
parrot.py >>>message = input("Tell me something, and I will repeat it back to you: ")
>>>print(message)
What I receive in python is
Tell me something, and I will repeat it back to you
The crash course says I should receive
Tell me something, and I will repeat it back to you: Hello everyone!
Hello everyone!
If the book isn't telling me to do this, how did the executed portion (Hello Everyone!) take part?
You are using the interpreter interactively.
put the two lines of code in a text file, save as parrot.py
now on command line, type:
python parrot.py
(Feb-05-2018, 05:05 PM)Demini Wrote: [ -> ]>>>message = input("Tell me something, and I will repeat it back to you: ")

The input() to the right of the equal sign is the 'prompt' the user see's, 'message' to the left of the equal sign is the variable name that will hold the response to what the user enters at the prompt, in this case you should enter Hello Everyone! at the prompt, which is then saved in the variable 'message'. The line print(message) is saying print out the value held in variable 'message'.

>>> message = input("Tell me something, and I will repeat it back to you: ")
Tell me something, and I will repeat it back to you: Howdy parrot
>>> print(message)
Howdy parrot
Thanks