Python Forum
Crash Course Chapter 7 - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Crash Course Chapter 7 (/thread-8071.html)



Crash Course Chapter 7 - Demini - Feb-05-2018

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?


RE: Crash Course Chapter 7 - Larz60+ - Feb-05-2018

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



RE: Crash Course Chapter 7 - sparkz_alot - Feb-05-2018

(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



RE: Crash Course Chapter 7 - Demini - Feb-05-2018

Thanks