+ 1

Why print (int("2.000")) is invalid??

18th Apr 2017, 5:51 PM
Vaishnavi Sowmya
Vaishnavi Sowmya - avatar
4 ответов
+ 2
your converting a string 2.000 to an int 2.000 which won't work u can't cast twice try using print print(int (float ("2.000")))
18th Apr 2017, 6:46 PM
Jack Bassililus
Jack Bassililus - avatar
+ 1
A double casting would work: print (int(float("2.000"))) # 2
18th Apr 2017, 6:22 PM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar
0
i dnt knw python much but i think u a passing value as string using "" so its unable to convert string to integer
18th Apr 2017, 5:55 PM
ashutosh mishra
ashutosh mishra - avatar
0
Thank you...
19th Apr 2017, 3:20 AM
Vaishnavi Sowmya
Vaishnavi Sowmya - avatar