0% found this document useful (0 votes)
2 views1 page

Day 10 - Taking User Input in Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

Day 10 - Taking User Input in Python

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Day 10 - 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 string/character hence we have to pass that into a variable

Syntax:

variable=input()
But input function returns the value as string. Hence we have to typecast them
whenever required to another datatype.

Example:

variable=int(input())
variable=float(input())
We can also display a text using input function. This will make input() function take user
input and display a message as well

Example:

a=input("Enter the name: ")


print(a)

Output:

Enter the name: Harry


Harry

You might also like