0
How to use type conversion i cant understand it
type conversion
3 Antworten
+ 2
u mean like
a = 420
print(str(a))
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.
0
this really helped