You are on page 1of 3

DIGITAL ASSIGNMENT

SUBJECT: PROBLEM SOLVING AND PROGRAMMING IN PYTHON


COURSE CODE: CSE1001
NAME: CHARAN SRIDHAR BHOGARAJU
REGNO: 19BBS0094

1. VOWELS AND CONSONANTS

CODE:
# NAME:  CHARAN  SRIDHAR  BHOGARAJU
# REGNO:  19BBS0094

vowels=['a','e','i','o','u']

letter=input('Enter a character: ')

if letter in vowels:
    print("letter is a vowel")
else:
    if letter=='y':
        print("Sometimes y is vowel and Sometimes y is consonant")
    else:
        print("letter is a consonant")

OUTPUT:
2. POLYGON

CODE:
# NAME:  CHARAN  SRIDHAR  BHOGARAJU
# REGNO:  19BBS0094

sides=int(input("Enter the number of sides of polygon: "))

polygons=["TRIANGLE","SQUARE","PENTAGON","HEXAGON"
,"HEPTAGON","OCTAGON","NONAGON","DECAGON"]

if(sides>=3 and sides<=10):
    print("IT IS {}".format(polygons[sides-3]))
else:
    print("PLEASE ENTER VALID NUMBER BETWEEN 3 AND 10")

OUTPUT:

3. MONTHS

CODE:
# NAME:  CHARAN  SRIDHAR  BHOGARAJU
# REGNO:  19BBS0094

lengthOfMonths=[28,29,30,31]

month=input("Enter the Month: ")

noOfDays31=["January","March","May","July","August","October","December"]
noOfDays30=["April","June","September","November"]

if month in noOfDays31:
    print("{} has 31 days".format(month))
elif month in noOfDays30:
    print("{} has 30 days".format(month))
else:
    print("February has 28 or 29 days")

OUTPUT:

You might also like