+ 2

Colon in Python

In Python is the usage of the colon to prompt the user to type something? For example "What's your name":, would be displayed as; What's your name: Is the colon there, because an input from the user is required. Without the colon can this work?

22nd Feb 2018, 5:06 PM
arbaaz
3 Answers
+ 4
Yes it would still work. It just makes it easy to tell where the question ends. TIP: put a space after the : sign to make it look cleaner! 😉
22nd Feb 2018, 5:24 PM
Jax
Jax - avatar
+ 3
Yes, without Colon(:) it works,example link: # Write your name # input() for asking to write print ("Write your name") ''' If don't want to show "Write Your name" please delete it ''' a = input() #Can show it 2 ways below: print("Your name is:"+" "+a) print ("Your name is" + " " + a)
22nd Feb 2018, 7:04 PM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar
+ 2
Thank you for your answers.
24th Feb 2018, 11:09 PM
arbaaz