# Casting - Integers
x = 3.5
print("Original value:", x)
print("Type of x:", type(x))
x = int(x)
print("Casted value:", x)
print("Type of x:", type(x))
Original value: 3.5
Type of x: <class 'float'>
Casted value: 3
Type of x: <class 'int'>
3.5
` to the variable `x
`. We then use the `print()
` function to print the original value of `x
`, as well as its type.int()
` function to cast `x
` to an integer. We assign the result of the `int()
` function back to the variable `x
`. print()
` function to print the casted value of `x
`, as well as its type.int()
` function has converted the float value `3.5
` to the integer value `3
`.