Typecasting Flashcards
(3 cards)
1
Q
What is type casting?
A
Type casting is converting a data type of a value to another type.
2
Q
How would you program a int to a float?
A
x=1
print(float(x))
twd: 1.0
3
Q
If
x=4
y=3.0
z=”8”
How would I make z into an int?
A
x is an int
y is a float
z is a str
z=int(z)
twd: 8