0% found this document useful (0 votes)
10 views4 pages

AMALIGA

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

AMALIGA

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

SIMPLE IF STATEMENT:

1) WAP TO PRINT A GIVEN STRING IF THE STRING IS PALINDROME ELSE IGNORE

demo=input("enter a string:")
if demo[ : :-1]==demo:
print(demo)

2) WAP PRINT THE REVERSE STRING IF LENGTH OF THE STRING SHOULD BE ODD AND LAST
CHARACTER OF THE STRING SHOULD BE VOWEL CHARACTER . ELSE IGNORE

char=input("enter a word:")
if (len(char)%2==1 and char[-1]in'AEIOUaeiou'):
print(char[ : :-1])

3) WAP TO CHECK WHETHER THE LAST DIGIT OF THE GIVEN INTEGER NUMBER IS LESSER THAN 5
OR NOT. IF IT IS TRUE, THE GIVEN NUMBER AS IT , ELSE IGNORE

num=input("enter an integer:")
if int(num[-1])<=5:
print(num)

IF ELSE STATEMENT:

4) WAP TO ACCEPT TWO INTEGER AND CHECK WHETHER THEY ARE EQUAL OR NOT

num1=int(input("enter the first integer:"))


num2=int(input("enter the second integer:"))
if num1==num2:
print("the two integer are equal")
else:
print("the two integer are not equal")

5) WAP TO FIND GREATEST OF TWO NUMBER

num1=int(input("enter the number1:"))


num2=int(input("enter the number2:"))
if num1>num2:
print("num1 is greater")
else :
print("num2 is greater")

6) WAP TO READ THE AGE OF A CANDIDATE AND DETERMINE WHETHER THE CANDIDATE IS
ELIGIBLE TO CASE HIS OWN VOTE

age=int(input("enter the age of the candidate:"))


if age>=18:
print("the candidate is eligible to cast a vote")
else:
print("the candidate is not eligible to cast a vote")

7)WAP TO CHECK WHETHER THE GIVEN 4 VALUES REPRESENT PREFECTLY EITHER SQUARE OR
RECTANGLE OR NOT. ELSE PRINT INVALID SHAPE ANGLE.

shape1=int(input("enter the value1:"))


shape2=int(input("enter the value2:"))
shape3=int(input("enter the value3:"))
shape4=int(input("enter the value4:"))
if shape1==shape2==shape3==shape4 or (shape1==shape3 and shape2==shape4):
print("it is either square or rectangle")
else :
print("it is invalid shape angle")

8) WAP TO CHECK THE GIVEN NUMBER IS EVEN NUMBER OR ODD NUMBER.

num=int(input("enter the number:"))


if num%2==0:
print("even number")
else:
print("odd number")

9)WAP TO CHECK THE GIVEN CHARACTER IS LOWERCASE ALPBAHET OR NOT.

char=input("enter the character:")


if 'a'<=char<='z':
print("character is lowercase alphabet")
else:
print("characterr is not lowercase alphabet")

10) WAP TO CHECK THE GIVEN CHARACTER LOWERCASE ALPABAHET OR UPPERCASE ALPHABET.

char=input("enter the character:")


if 'a'<=char<='z':
print("given character is lowercase alphabet")
else:
print("given character is upper alphabet")

11) WAP TO CHECK THE GIVEN CHARACTER IS ALPHABET OR DIGIT.

char=input("enter the character:")


if 'a'<=char<='z' or 'A'<=char<='Z':
print("given character is alphabet")
else:
print("given character is digit")

12) WAP TO CHECK THE LAST DIGIT OF THE GIVEN NUMBER IS ODD. IF IT IS TRUE PRINT THE
LAST DIGIT OF THE NUMBER ELSE PRINT THE NUMBER AS IT IS.

num=int(input("enter the number:"))


if num%2==1:
print(int(str(num)[-1]))
else :
print(num)

13) WAP TO CHECK THE GIVEN CHARACTERIS DIGIT OR NOT.

char=input("enter the character:")


if'0'<=char<='9':
print("the given character is digit")
else:
print("the given character is not digit")

14) WAP TO CHECK THE GIVEN CHARACTER IS SPECIAL SYMBOL OR NOT.

char=input("enter the character:")


if not('a'<=char<='z' or 'A'<=char<='Z' or '0'<=char<='9'):
print("given character is special symbol")
else:
print("given character is not special symbol")

IF ELIF ELSE STATEMENT:

15) WAP TO FIND THE RELATIONS BETWEEN THE TWO NUMBERS. [greater or lesser or
equal].

num1=int(input("enter the first number:"))


num2=int(input("enter the second number:"))
if num1>num2:
print("given number is greater")
elif num1<num2:
print("given number is lesser")
else:
print("given number is equal")

16) WAP TO ACCEPT THE AGE OF 4 PEOPLE AND DISPLAY THE YOUNGEST ONE.

age1=int(input("enter the age1:"))


age2=int(input("enter the age2:"))
age3=int(input("enter the age3:"))
age4=int(input("enter the age4:"))
if age1<age2 and age1<age3 and age1<age4:
print("age1 is younger")
elif age2<age3 and age2<4:
print("age2 is younger")
elif age3<age4:
print("age3 is younger")
else:
print("age4 is younger")

17) WAP TO CONSOLIDATE THE STUDENT GRADE FROM 5 SUBJECT MARKS. PRINT 'A' GRADE IF
THEIR PERCENTAGE IS >90 OR PRINT 'B' GRADE IF THEIR PERCENTAGE IS >75 AND <=90 OR
PRINT 'C' GRADE IF THEIR PERCENTAGE IS >65 AND <=75 OR PRINT 'D' GRADE IF THEIR
PRECENTAGE IS <=65.

mark1=int(input("enter the mark1:"))


mark2=int(input("enter the mark2:"))
mark3=int(input("enter the mark3:"))
mark4=int(input("enter the mark4:"))
mark5=int(input("enter the mark5:"))
if mark1>90:
print("A grade")
elif 75<mark2<=90:
print("B grade")
elif 65<mark3<=75:
print("C grade")
else:
print("D grade")

18) WAP TO PRINT 'FIZZ' IF THE GIVEN NUMBER DIVISIBLE BY 3 OR PRINT 'BUZZ' IF THE
GIVEN NUMBER DIVISIBLE BY 5 OR PRINT 'FIZZ BUZZ' IF THE GIVEN NUMBER DIVISIBLE BY
BOTH 3 AND 5 PRINT ELSE PRINT THE NUMBER AS IT IS.

num=int(input("enter the number:"))


if num%3==0 and num%5==0:
print("FIZZ BUZZ")
elif num%3==0:
print("FIZZ")
elif num%5==0:
print("BUZZ")
else:
print(num)

You might also like