explain it type conversion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

explain it type conversion

#type conversion a = "1001" print(int(a,2)) print(int(a,10)) print(int(a))

25th Oct 2018, 4:36 PM
raghvendra upadhyay
raghvendra upadhyay - avatar
1 Answer
0
The second argument gives the base of the number that's shown in the string literal. So int(a, 2) means that a is to be interpreted as a binary.
25th Oct 2018, 5:37 PM
HonFu
HonFu - avatar