Program to check whether the number is float

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
  1. Take any number of your choice as input.
  2. Check the type of the input number by using type().
  3. Check whether the given number is float or not using an if-else statement.
  4. Print the output.
				
					num1 = 12.6

if type(num1) == float:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

Related Articles

check whether the given number is an integer or not.

check whether the given input is a string or not.

Check whether the number is an integer or not.

In this python if else program, we will check whether the given number is an integer or not.

An Integer is a whole number, which includes negative numbers, positive numbers, and zero. Integers don’t include any fractions or rational parts

Steps to solve the program
  1. Take any number of your choice as input.
  2. Check the type of the input number by using type().
  3. Check whether the given number is an integer or not using an if-else statement.
  4. Print the output.
				
					num1 = 54

if type(num1) == int:
    print("True")
else:
    print("False")
				
			

Output :

				
					True
				
			

Related Articles

check whether the given character is lowercase or not.

check whether the given number is float or not.

Check whether the character is lowercase or not.

In this python if else program, we will check whether the given character is lowercase or not.

Steps to solve the program
  1. Take a character as input through the user.
  2. Check whether a given character is uppercase or not using islower().
  3. Use an if-else statement for this purpose.
  4. Print the output.
				
					char = input("Enter a character: ")

if char.islower():
    print("True")
else:
    print("False")
				
			

Output :

				
					Enter a character: c
True
				
			

Related Articles

check whether a given character is uppercase or not.

check whether the given number is an integer or not.

Print the largest number from two numbers.

In this python if else program, we will print the largest number from two numbers.

Steps to solve the program
  1. Take two numbers as input through the user.
  2. Check which of them is a greater number using the if-else statement.
  3. Print the largest number.
				
					num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))

if num1>num2:
    print(f"{num1} is greatest")
else:
    print(f"{num2} is greatest")
				
			

Output :

				
					Enter 1st number: 54
Enter 2nd number: 21
54 is greatest
				
			

Related Articles

check whether the given number is positive or negative and even or odd.

check whether a given character is uppercase or not.

The number is positive or negative and even or odd.

In this python if else program, we will check whether the number is positive or negative and even or odd.

Positive number:
A positive number is any number greater than zero. The positive number includes natural numbers.
Negative number:
A negative number is any number that is less than zero.
Odd number:
Odd numbers are those numbers that cannot be divided into two equal parts or cannot be divided by 2.
Even number:
even numbers are those numbers that can be divided into two equal parts or can be divided by 2.

Hint:
Use nested if-else statements.

Steps to solve the program
  1. Take a number as input through the user.
  2. Check whether the given number is positive or negative and even or odd with the help of the if-else statements
  3. Print the respective output.
				
					num = int(input("Enter a number: "))

if num>0:
    if num%2 == 0:
        print("The given number is positive and even")
    else:
        print("The given number is positive and odd")
else:
    if num%2 == 0:
        print("The given number is negative and even")
    else:
        print("The given number is negative and odd")
				
			

Output :

				
					Enter a number: 26
The given number is positive and even
				
			

Related Articles

check whether the given number is negative or not.

print the largest number from two numbers.

Check whether the given number is negative or not.

In this python if else program, we will check whether the given number is negative or not.

Negative number:
A negative number is any number that is less than zero.

Steps to solve the program
  1. Take a number as input through the user.
  2. If the number is negative then print True, else print False.
  3. Use an if-else statement for this purpose.
  4. Print the output.
				
					num = int(input("Enter a number: "))

if num<0:
    print("True")
else:
    print("False")
				
			

Output :

				
					Enter a number: -45
True
				
			

Related Articles

check whether the given number is positive or not.

check whether the given number is positive or negative and even or odd.

Check whether the given number is positive or not.

In this python if else program, we will check whether the given number is positive or not.

Positive number:
A positive number is any number greater than zero. Positive number includes natural numbers.

Steps to solve the program
  1. Take a number as input through the user.
  2. If the number is positive then print True, else print False.
  3. Use an if-else statement for this purpose.
  4. Print the output.
				
					num = int(input("Enter a number: "))

if num>0:
    print("True")
else:
    print("False")
				
			

Output :

				
					Enter a number: 20
True
				
			

Related Articles

check whether a student has passed the exam.

check whether the given number is negative or not.

Check whether a student has passed the exam.

In this python if else program, we will check whether a student has passed the exam or not depending on the marks scored by the student.

Condition to pass the test:
If the marks obtained by the student are equal to or greater than 45 then the student has passed the test, otherwise student has failed the test.

Steps to solve the program
  1. Take the marks of the student as input through the user.
  2. Use an if-else statement to determine whether a student has passed the exam or not.
  3. Use the criteria given in the question to determine the outcome.
  4. Print the output.
				
					marks = int(input("Enter marks of a student: "))

if marks>=45:
    print("Pass")
else:
    print("Fail")
				
			

Output :

				
					Enter marks of a student: 50
Pass
				
			

Related Articles

check if any given string is palindrome or not

check whether the given number is positive or not.

Check whether the string is palindrome or not.

In this python if else program, we will program to check if any given string is palindrome or not.

A string is a palindrome if it remains the same from both ends. When you reverse a string, it is same as the original string.

Hint:
Use indexing.

Steps to solve the program
  1. Take a string as input.
  2. Reverse the given string and store the result in another variable.
  3. Compare both strings using an if-else statement.
  4. If both the strings are equal then the string is palindrome, else string is not palinfrome.
  5. Print the respective output.
				
					str1 = 'jaj'
str2 = str1[::-1]

if str1 == str2:
    print("It is a palindrome string")
else:
    print("It is not a palindrome string")
				
			

Output :

				
					It is a palindrome string
				
			

Related Articles

check whether any given number is a palindrome.

check whether a student has passed the exam

Python program to check whether a number is palindrome.

In this python if else program, we will check whether any given number is palindrome number or not. 

A palindrome number is a number that remains the same when digits are reversed. For example, the number 121 is a palindrome number, but 253 is not a palindrome number.

Hint:
Use string.
Use indexing.

Steps to solve the program
  1. Take a number as input.
  2. Reverse the given number and store it in another variable.
  3. Check whether both the numbers are equal or not using an if-else statement.
  4. Print the respective output.
				
					num1 = 121
num2 = str(num1)

if num1 == int(num2[::-1]):
    print("It is a palindrome number")
else:
    print("It is not a palindrome number")
				
			

Output :

				
					It is a palindrome number
				
			

Related Articles

check any person eligible to vote or not

check if any given string is palindrome or not