Python Programs
Holiday Homework (2024-25)
SHAURYA VARDHAN SHARMA
IX - A
Pitney Bowes - Confidential
PROGRAM 1
print('Welcome to the code which converts values given in kilometers
into values of meters and centimeters.')
km = int(input('Enter the value in kilometer: '))
ch = int(input('If you want to convert to meter, enter 1 and if you want to
convert to centimeters then enter 2. Please enter the value: '))
if ch == 1:
print(km*1000,'m')
elif ch == 2:
print(km*100000,'cm')
PROGRAM 2
num1 = float(input('Print first number: '))
num2 = float(input('Print second number: '))
ch = float(input('Enter 1 for addition, 2 for subtraction, 3 for multiplication, 4
for division. Enter your choice: '))
if ch == 1:
print(num1+num2)
elif ch == 2:
print(num1-num2)
elif ch == 3:
print(num1*num2)
elif ch == 4:
print(num1/num2)
Pitney Bowes - Confidential
PROGRAM 3
age = 18
gage = int(input('Please enter your current age: '))
if gage >= age:
print('You are eligible to vote, happy voting. :)')
else:
print('You are not eligible to vote, please come back when you are
older')
PROGRAM 4
gr = int(input('Please enter your percentage: '))
if gr >= 90:
print('You have scored an A grade.')
elif gr < 90 and gr >= 75:
print('You have scored a B grade.')
elif gr < 75 and gr >= 60:
print('You have scored a C grade.')
elif gr < 60 and gr >= 45:
print('You have scored a D grade.')
elif gr < 45 and gr >= 33:
print('YOu have scored an E grade.')
elif gr < 33:
print('You have scored an F grade and have failed')
Pitney Bowes - Confidential
PROGRAM 5
num = int(input('Enter an integer: '))
if num < 0:
print('The number is negative.')
elif num == 0:
print('THe number is a zero.')
elif num > 0:
print('The number is positive.')
Pitney Bowes - Confidential