num = 8
num_float = float(num)
print(num_float)
#source code --> clcoding.com
Explanation:
Create an Integer Variable:
num = 8: We store the integer value 8 in the variable num.
Convert Integer to Float:
float(num): The float() function converts an integer into a floating-point number.
In this case, 8 is converted to 8.0.
Print the Result:
print(num_float): Displays the converted floating-point number on the screen.
Output:
8.0
0 Comments:
Post a Comment