0

How to print some thing if the answer is in float on python

in Python suppose x =5 and a = x/2 now I want to print "hello" if the answer is float else "sorry"..... plz somebody help me with it

22nd Dec 2017, 6:08 PM
Vivek Tamang
Vivek Tamang - avatar
7 Answers
0
Try with raising exceptions: TypeError?
22nd Dec 2017, 6:16 PM
One
One - avatar
0
sorry I couldn't not understand
22nd Dec 2017, 6:17 PM
Vivek Tamang
Vivek Tamang - avatar
0
Yeah sorry my fault... Here is a link to the module I am talking about: https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2440/
22nd Dec 2017, 6:19 PM
One
One - avatar
0
There is something called type()-function. Example : >>>t = 42 >>>print(type(t) is int) True >>>print(type(t)) <type 'int'>
22nd Dec 2017, 6:21 PM
Andreas K
Andreas K - avatar
0
I want in python
22nd Dec 2017, 6:31 PM
Vivek Tamang
Vivek Tamang - avatar
0
It's python code. I removed one typo. Sry for this.
22nd Dec 2017, 6:38 PM
Andreas K
Andreas K - avatar
0
x = input() if x/2 { if it is float} print (float) else print( int) can u make this in Python code...so I could understand...plz
22nd Dec 2017, 6:41 PM
Vivek Tamang
Vivek Tamang - avatar