Take Input From User In Python. Topic 8

Taking User Input in python

In Python, we can take user input directly by using input() function. This input function gives a return value as a string/character hence we have to pass that into a variable.

Syntax:

variable=input()

But the input function returns the value as a string. We can typecast them whenever required to another datatype.

Python
variable_name = int(input())
variable_name = float(input())

Example:

name = input("Enter the name: ")
print(name)

The Output Of This Code Will Be:

Python
Enter the name: Priti
Priti

Sometimes we need to change the types of variables after taking input from the user. Read more

I hope you understand how to take Input From users in Python. If you do not understand this topic just comment below with your email ID, and I will mail back to you.

Finite number of  lines code and infinite possibilities

Programmer, Arpan Bera

Leave a Reply

Your email address will not be published. Required fields are marked *

ABOUT ME
Arpan Bera

Coding is like Love – everyone can start, but only a few finish without errors

Keep Updated to our News and Blog