Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python
Program 1
#conditional Statements
# n=int(input("Enter a number"))
# if(n>50):
# print("Hello Friends")
# print("DataFlair")
# print("Bye Bye")
#Word format of number
# n=int(input("Enter a number"))
# if(n==1):
# print("One")
# if(n==2):
# print("Two")
# if(n==3):
# print("Three")
# if(n==4):
# print("Four")
# if(n==5):
# print("Five")
# if(n<0 or n>5):
# print("Invalid number")
# Nested if (Selection of Driver)
# name=input("Enter Your Name")
# age=int(input("Enter Your Age"))
# ms=input("Enter Your Marital Status")
# if(name=="Rajesh" or name=="rajesh"):
# if(age<50):
# if(ms=='M' or ms=='m'):
# print("You are selected")
# if else
# n=int(input("Enter a number"))
# if(n>=0):
# print("No is +ive")
# else:
# print("No is -ive")
# Program for even odd number
# n=int(input("Enter a number"))
# if(n%2):
# print("No is Odd")
# else:
# print("No is Even")
#Word format of number
# n=int(input("Enter a number"))
# if(n==1):
# print("One")
# elif(n==2):
# print("Two")
# elif(n==3):
# print("Three")
# elif(n==4):
# print("Four")
# elif(n==5):
# print("Five")
# else:
# print("Invalid number")
# Check Vowel character
ch=input("Enter a character")
if(ch=="a" or ch=="A"):
print("Vowel")
elif(ch=="e" or ch=="E"):
print("Vowel")
elif(ch=="i" or ch=="I"):
print("Vowel")
elif(ch=="o" or ch=="O"):
print("Vowel")
elif(ch=="u" or ch=="U"):
print("Vowel")
else:
print("Not A Vowel")
Program 2
# Program for Leap Year
# year=int(input("Enter a Year"))
# if((year%400==0) or (year%100!=0) and (year%4==0)):
# print("This year is a leap year")
# else:
# print("This year is not a leap year")
# Grater between Three Numbers
# a=int(input("Enter first number"))
# b=int(input("Enter second number"))
# c=int(input("Enter third number"))
# if(a>b and a>c):
# print("Grater Number is ",a)
# elif(b>c):
# print("Grater Number is ",b)
# else:
# print("Grater Number is ",c)
# Menu Application
a=int(input("Enter First Number"))
b=int(input("Enter Second Number"))
print("-----------------Menu Application----------------")
print("\t1. MAX \n \t2.MIN \n \t3.SWAP")
print("-----------------------------------------------------")
choice=int(input("Enter your choice"))
if(choice==1):
print(max(a,b))
elif(choice==2):
print(min(a,b))
elif(choice==3):
print("Before swaping ",a ," ",b)
a,b=b,a
print("After swaping ",a ," ",b)