+ 1
from tutorial Python 3 quiz: Input function
word = input("enter a word: ") print(word + " shop") When prompted I enter: cheese My output is then "Enter a word: Cheese shop", am I missing something or why is the answer and all other comments showing only 'Cheese shop', how did 'Enter a word:' get dropped?
3 ответов
+ 2
Simply by
word = input()
0
After the ":" type "\n". "\n" moves the cursor to the next line
0
"Enter a word” is the instruction that your program gives to readers. You can see that it’s an instruction because it is inside the () after input. If you follow this instruction and enter “cheese”, then this becomes the value assigned to “word”. Now word is equal to cheese, so word+shop becomes cheese+shop.