Exercise Set 5

Exercise 1 of 8

Write a line of code to convert a variable x to a string.

Your code

Exercise 2 of 8

Write a line of code to convert a variable x to an integer.

Your code

Exercise 3 of 8

Write a line of code to convert a variable x to a float.

Your code

Exercise 4 of 8

Write a line of code to take input from the user and convert it to an integer.

Your code

Exercise 5 of 8

Write a line of code to take input from the user and convert it to a float.

Your code

Exercise 6 of 8

Fix the error in the code.
width = 15
length = input("Enter the length: ")
area = length * width
print(f"The area is {area}.")

Your code

Exercise 7 of 8

Fix the error in the code.
age = input("How old are you? ")
future_age = age + 20
print(f"In 20 years, you will be {future_age} years old.")

Your code

Exercise 8 of 8

Fix the error in the code.
result = "21" / 7
print(result)

Your code