Assume that we execute the following assignment statements:
width = 17
height = 12.0
For each of the following expressions, write the value of the expression and the type ( of the value of the expression )
1. width/ /2
2. width/2.0
3. height/3
4. 1 + 2 * 5
Use the Python interpreter to check your answers
width = float(input("Enter the Width: "))
height = float(input("Enter the Height: "))
print("Value is : ", width // 2, "and type is: " ,type(width // 2))
print("Value is : ", width / 2.0 ,"and type is: " , type(width / 2.0))
print("Value is : ", width / 3 ,"and type is: " , type(width / 3))
print("Value is :" , 1 + 2 * 5,"and type is: " , type(1 + 2 * 5))
Comments
Leave a comment