0% found this document useful (0 votes)
24 views2 pages

1

The document contains 6 Python code snippets that check for the greatest number, check if a year is a leap year, convert between Celsius and Fahrenheit, check the type of triangle based on side lengths, check if a character is a vowel or consonant, and check the number of days in a given month.

Uploaded by

laroy80863
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)
24 views2 pages

1

The document contains 6 Python code snippets that check for the greatest number, check if a year is a leap year, convert between Celsius and Fahrenheit, check the type of triangle based on side lengths, check if a character is a vowel or consonant, and check the number of days in a given month.

Uploaded by

laroy80863
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/ 2

1.

a = eval(input("Enter 1st Number"))


b = eval(input("Enter 2nd Number"))
c = eval(input("Enter 3rd Number"))

if(a > b and a > c):


print("" ,a, "is the Greatest Number")
elif(b > a and b > c):
print("" ,b, "is the Greatest Number")
else:
print("" ,c, "is the Greatest Number")

2.

a = int(input("Enter Year"))

if(a%400 ==0):
print("It is a leap year")
else:
if(a%4 ==0 and a%100 !=0):
print("It is a leap year")
else:
print("It is not a leap year")

3.
b=1
while(b==1):
print(" 1. <-- Celsius to Fahrenheit")
print(" 2. <-- Fahrenheit to Celsius")
print(" 3. <-- Exit")
a = int(input("Enter 1,2 or 3 \n "))
if(a == 1):
y = eval(input("Enter Celsius :-"))
c = (y*1.8) + 32
print("",y,"Celsius is",c,"Fahrenheit \n")
elif(a == 2):
z = eval(input("Enter Fahrenheit :-"))
f = (z - 32) * 5/9
print("" ,z, "Fahrenheit is" ,f,"Celsius \n")
elif(a == 3):
exit()
else:
print("Invalid Code Number")

4.

a=eval(input("Enter Length Of 1st Side"))


b=eval(input("Enter Length Of 2nd Side"))
c=eval(input("Enter Length Of 3rd Side"))
if( a == b and a == c and b == c):
print(" Its An Equilateral Triangle")
elif( a == b or a == c or b == c):
print(" Its An Isoceles Triangle")
else:
print(" Its A Scalene Triangle")

5.

a = input(" Enter Alphabet ")


b = a.lower()
if( b == "a" or b == "e" or b == "i" or b == "o" or b == "u"):
print("Its A Vowel")
else:
print("Its A Consonant")

6.

a = input("Enter Month")
b = a.lower()

if(b == 'january' or b == 'march' or b == 'may' or b == 'july' or b == 'august' or


b == 'october' or b == 'december'):
print("It has 31 Days")
elif(b == 'april' or b == 'june' or b == 'september' or b == 'november'):N
print("It has 30 days")
elif(b == 'february'):
y=int(input("Enter Year"))
if(y%400 ==0):
print("It has 29 Days")
else:
if(a%4 ==0 and a%100 !=0):
print("It has 29 Days")
else:
print("It has 28 Days")

You might also like