Python | if else example: Here, we are implementing a program, it will read age from the user and check whether person is eligible for voting or not.
# Checking if marks are greater than or equal to 60 if marks >= 60: print("You are eligible for the Intellipaat certification!") else: print("Keep learning and try again!") Output: Explanation: Here, it is checked whether the marks are equal to or more than 60, and prints the mess...
Given age of a person and we have to check whether person is eligible for voting or not using Ternary operator.To solve this problem, we will use ternary operator, consider the below syntax of ternary operator,[on_true] if [expression] else [on_false] Here,...
Input: num=int(input("enter the number : ")) if (num>=0): print('whole number') Output: enter the number : 5 whole number Python Copy Input: x=int(input("enter your age : ")) if (x>=18): print("you are eligible for voting") Output: enter your age : 21 you are eligible...