TAKING USER INPUT IN PYTHON

Programs are written to solve end user’s problem. To do this you need to get some information from user, at that time input ( ) function is used.

What input ( ) function does:

While run time when python sees input() function. In the program it pauses the program and wait for the user to provide some input, when python receives end user’s input, python stores it in a variable (this variable is declared programmer) to make it convenient for you to work with.

Syntax

    input(prompt)

Here prompt represent a string as message to take user input

Example 1:

1

Example 2

2

Leave a comment