+ 1

A colon in user's input

In the calculator instruction there is this line: user_input = input(": ") Why is the colon inside of the brackets?

5th Jan 2017, 7:40 AM
Marcin Filus
Marcin Filus - avatar
1 Answer
0
The colon is inside the parenthesis because that's the first thing the user will see. It's the prompt message that indicates that the program is waiting for input. The input function allows us to take input from the user while giving us the ability to display a message prior to taking input. To specify that message, we place them as arguments. name = input("Please enter your name: ") That line above will prompt the user with, "Please enter your name: " then whatever that individual types will be stored in the variable name.
12th Jan 2017, 12:08 AM
Don
Don - avatar