type conversion errors | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

type conversion errors

how to write the input codes

3rd Jan 2020, 1:34 PM
Bradley Abwao
Bradley Abwao - avatar
2 Answers
+ 4
First you take input: put = input() (It is a string) You can convert it to other datatypes using the class name of the datatype you want the input to be converted. float(put) #Converts input to float if input is valid. int(put) #Converts input to integer if input is valid.
3rd Jan 2020, 1:45 PM
Seb TheS
Seb TheS - avatar
+ 2
?
3rd Jan 2020, 1:37 PM
Aymane Boukrouh
Aymane Boukrouh - avatar