7. Data Types Flashcards
1
Q
What is casting ?
A
Casting is when you convert one data type into another data type
2
Q
convert Integer into Real
A
int_value = 10
real_value = float(int_value)
Output = 10.0
3
Q
Convert Real into Integer
A
real_value = 10.4
int_value = int(real_value)
Output = 10
4
Q
Convert String to Integer
A
int_str = “6”
int_value = int(int_str)
Output = 6
5
Q
Convert Integer into String
A
value = 3
str_value = str(value)
Output = “3”
6
Q
Convert Boolean into String
A
bool_value = True
str_value = str(bool_value)
Output = “True”
7
Q
Convert String into Boolean
A
bool_str = “False”
bool_value = bool(bool_str)
Output = “False”