Ravi Python
Ravi Python
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
string=(input("enter the string:"))
length=len(string)
vowel="aeiouAEIOU"
if len(string)%2!=0 and string[::-1] in vowel:
print( "reverse string",string [::-1])
3)#WAP TO CHECK WHEATHER THA LAST DIGIT OF THE GIVEN INTEGER NUMBER IS LESSER THAN
5 OR NOT.IF IT IS TRUE,THE GIVEN NYMBER AS IT IS ELSE IGNORE
demo=int(input("enter the integer:"))
lastdigt=demo%10
if lastdigt<5:
print("The given number is",demo)
IF ELSE STATEMENT
4)#WAP TO ACCEPT TWO INTEGERS AND CHECK WHETHER THEY ARE EQUAL OR NOT
a=int(input("enter the value1:"))
b=int(input("enter the value2:"))
if a==b:
print("it is a equal")
else:
print("it is a not equal")
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:"))
if age>18:
print("both are eligible person")
else:
print("not eligible person")
7)#WAP TO CHECK WHETHER THE GIVEN 4 VALUES REPRESENT PERFECTLY EITHER SQUARE OR
RECTANGLE OR NOT.ELSE PRINT INVALID SHAPE ANGLE
val1=int(input("enter the value1:"))
val2=int(input("enter the value2:"))
val3=int(input("enter the value3:"))
val4=int(input("enter the value4:"))
if(val1==val2==val3==val4)or(val1==val3 and val2==val4):
print("it is valid shape")
else:
print("it is a invalid shape")
11)#WAP TO CHECK THE LAST DIGIT OF THE GIVEN NUMBER IS ODD. IF IT TRUE PRINT THE
LAST OF THE NUMBER ELSE PRINT THE NUMBER
num=int(input("enter the digit:"))
lastdigit=num%10
if lastdigit%2==1:
print("last digit",lastdigit)
else:
print(" the num",num)
16) #wap to consolidate the subject 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 percentage is <=65
mark1=int(input("enter mark1"))
mark2=int(input("enter mark2"))
mark3=int(input("enter mark3"))
mark4=int(input("enter makr4"))
mark5=int(input("enter mark5"))
percent=(mark1+mark2+mark3+mark4+mark5)//5
print("The percentage is ",percent)
if percent>90:
print("Grade A")
elif percent>75 and percent<=90:
print("Grade B")
elif percent>65 and percent<=75:
print("Grade C")
else:
print("Grade D")
17)#wap to print 'fizz' if the given number divisible by 3 or print 'buzz' if the
given number divisible by 5 or print 'fizz bizz' if the given number divisible by
both 3
and 5 print else print the number as it is
num=int(input("enter a 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)