Skip to main content

Python Input and Type Casting.



 

Main Key Points

  • input() // for get userinput value
  • int()    // 
  • eval() //
  • float()  //

x =input("Enter Your age-") // 23

print(x)


output

23


int() Type cast

x = int(input("Enter Your age-")) // only enter integer value

print(x)



output

23


float() type cast

x = float(input("Enter Your age-")) // 44

print(x)



output

44.0


eval() type casting - any types of value converts

x = eval(input("Enter Your age-")) // enter- 0b1111( 15 binary number)

print(x)



output

15

Comments