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
Asked
Active
Viewed 103 times
-2
-
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 Answers
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