+4 votes
in Programming Languages by (9.6k points)
Is there any Python function that I can use to accept user input from the keyboard at runtime? It should be something similar to the scanf() function in C.

1 Answer

+1 vote
by (42.1k points)

The input() function can be used to accept input from the keyboard at runtime? The function prompts for input from the user and waits for it.

Here is an example:

>>> name = input("Enter your name:")
Enter your name:hello world
>>> name
'hello world'
>>>

...