1# Use the function float() to turn a string into a float
2string = '123.456'
3number = float(string)
4number
5# Output:
6# 123.456
1not_float = '.0975'
2is_float = .0986
3
4print(not_float)
5print(is_float)
6
7# Notice this won't work
8# new_number = not_float + is_float
9
10# This will convert it to a float
11new_number = float(not_float) + is_float
12
13print(new_number)
1
2x = int(1) # x will be 1
3
4y = int(2.8) # y will be 2
5
6z = int("3") # z will be 3
7
8