-2

Is it possible to write a input statement that can take any kind of input such as int,float on user's wish.As we cannot enter a floating number using a input statement defined for integers in python

Sidramesh
  • 3
  • 1
  • 4
  • Well, if you know that the user is going to input float then `float(raw_input())` it! – Ubdus Samad Nov 04 '17 at 07:44
  • I want to make a calculator that accept the input first then do the operation,so here user can enter any data type so how can I make that heppen – Sidramesh Nov 04 '17 at 07:46

1 Answers1

0

Just always convert to a float and then even if they enter an int, the calculations will still work out fine.

Joe Iddon
  • 20,101
  • 7
  • 33
  • 54