Python | Typecasting Input to Integer, Float
Syntax:
int(input())
Example:
# input a number num = int(input("Input a value: ")) # printing input value print "num = ", num
Output
Input a value: 10 num = 10
float(input())
# input a number num = float(input("Input a value: ")) # printing input value print "num = ", num
Input a value: 10.23 num = 10.23
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Typecasting input to integer
Syntax:
Example:
Output
Typecasting Input to float
Syntax:
Example:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer