Complete the code to convert the string '123' to an integer.
num = [1]('123') print(num)
The int() function converts a string representing a whole number into an integer type.
Complete the code to get the decimal number 3.14 from a string.
pi = [1]('3.14') print(pi)
The float() function converts a string with decimals into a floating-point number.
Fix the error in the code to correctly convert the float 7.0 to an integer.
number = 7.0 result = [1](number) print(result)
The int() function converts a float to an integer by removing the decimal part.
Fill both blanks to create a dictionary with numbers as keys and their squares as values, only for numbers greater than 3.
squares = {x: x[1]2 for x in range(1, 6) if x [2] 3}
print(squares)The ** operator calculates powers, and > filters numbers greater than 3.
Fill all three blanks to create a dictionary with uppercase keys, values as floats, and only include values greater than 0.
result = [1]: [2] for k, v in data.items() if v [3] 0}}
Keys are converted to uppercase with k.upper(), values converted to float with float(v), and filtered for values greater than 0 with >.