+4 votes
in Programming Languages by (40.5k 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 (348k points)
selected by
 
Best answer

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'
>>>


...