In this python if else program, we will check whether the given number is float or not.
A float is a floating-point number, which means it is a number that has a decimal place. Floats are used when more precision is needed.
Steps to solve the program
- Take any number of your choice as input.
- Check the type of the input number by using type().
- Check whether the given number is float or not using an if-else statement.
- Print the output.
num1 = 12.6
if type(num1) == float:
print("True")
else:
print("False")
Output :
True
Related Articles
Python program to check whether the given input is a string or not.
Python program to print all the numbers from 10-15 except 13.
Python program to find the electricity bill. According to the following conditions:
Python program to check whether a given year is a leap or not.
Python program to check whether an alphabet is a vowel.