-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtype_casting.py
More file actions
25 lines (18 loc) · 907 Bytes
/
type_casting.py
File metadata and controls
25 lines (18 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
value_one = "10"
print(int(value_one)) # Converts string to integer
print(float(value_one)) # Converts string to float
print(complex(value_one)) # Converts string to complex number
print(bool(value_one)) # Converts string to boolean
value_two = 25.67
print(int(value_two)) # Converts float to integer
print(str(value_two)) # Converts float to string
print(complex(value_two)) # Converts float to complex number
print(bool(value_two)) # Converts float to boolean
print(str(value_two)) # Converts float to string
value_three = "My CBF Fest"
print(bool(value_three)) # Converts string to boolean
print(int(value_three))
string_one = "CBF"
print(list(string_one)) # Converts string to list of characters
print(tuple(string_one)) # Converts string to tuple of characters
print(set(string_one)) # Converts string to set of characters