Python 1
Python 1
-----------------------------------
# wap to print a given string if the string is palindrome else ignore. /using
simple if statement/
demo=input("Enter a string:")
if (demo[: :-1]==demo):
print("String is palindrome" )
#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
# wap to check whether the last digit of the given integer number is lesser than 5
or not . if it
num=int(input("Enter the number:"))
if str(num)[-1]<5:
print(num)
# IF ELSE STATEMENT....
#wap to accept two integers and check whether they are equal or not.
num1=int(input("Enter the value:"))
num2=int(input("Enter the value:"))
if num1==num2:
print("They are equal")
else:
print("They are not equal")
#wap to read the age of a candidate and determine whether the candidate is eligible
to case his own vote.
mani=int(input("Enter the value:"))
if mani>=18:
print("Candidate Eligible for vote..")
else:
print("Candidate Not Eligible for vote..")
#wap to check whether the given 4 values represent prefectly either square or
rectangle or not.else print invalid shape angle.
num1=int(input("Enter the number 1:"))
num2=int(input("Enter the number 2:"))
num3=int(input("Enter the number 3:"))
num4=int(input("Enter the number 4:"))
if (num1==num2==num3==num4) or (num1==num3 and num2==num4):
print("Either square or rectangle")
else:
print("Invalid shape angle")
#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(str(num)[-1])
else:
print(num)
#wap to accept the age of 4 people and display the youngest one.
num1=int(input("Enter the number1:"))
num2=int(input("Enter the number2:"))
num3=int(input("Enter the number3:"))
num4=int(input("Enter the number4:"))
if num1<num2 and num1<num3 and num1<num4:
print("Person1 is Youngest one..")
elif num2<num3 and num2<num4:
print("Person2 is Youngest one...")
elif num3<num4:
print("Person3 is Youngest one...")
else:
print("Person4 is Youngest one...")