0

How to use type conversion i cant understand it

type conversion

30th Jun 2017, 4:55 PM
Narender suThar
3 Respostas
+ 2
u mean like a = 420 print(str(a))
30th Jun 2017, 5:06 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
0
You don't know the syntax of type conversion or it's purpose? Syntax: a = "77" Variable "a" has the characters "77". NOT to be confused with the integers 77. a = int(a) Variable "a" has now been converted from string (a set of characters) to the integer 77. Purpose: In this example the purpose is to transform the sequence of characters "77" into the integer (number). Now you can do math with it. Before: a = "77" b = a + 1 print(b) You will get an error. After: a = "77" a = int(a) b = a + 1 print(b) 78 Not sure if I answered your question. Hope this helps.
30th Jun 2017, 6:32 PM
Code101
Code101 - avatar
0
this really helped
2nd Jul 2017, 2:04 AM
Narender suThar