Corrected Python Programs
PROGRAM NO.-1
Write a program to input two numbers and add the values.
a = int(input("Enter the First Number: "))
b = int(input("Enter the Second Number: "))
c = a + b
print("The Total of Two Numbers:", c)
PROGRAM NO.-2
Write a program to calculate Simple Interest. (Hint: SI=P*R*T/100).
p = int(input("Enter the Principal Amount: "))
t = int(input("Enter the Time Period: "))
r = int(input("Enter the Rate of Interest: "))
si = (p * t * r) / 100
print("The Simple Interest is:", si)
PROGRAM NO.-3
Write a program to input five subject marks and calculate its Total, Average and find result
(Pass/Fail).
english = int(input("Enter English Mark: "))
lang = int(input("Enter Language Mark: "))
maths = int(input("Enter Maths Mark: "))
science = int(input("Enter Science Mark: "))
social = int(input("Enter Social Mark: "))
total = english + lang + maths + science + social
average = total / 5.0
if average >= 40:
print("Result: Pass")
else:
print("Result: Fail")
print("\nThe Total marks are:", total)
print("\nThe Average marks are:", average)
PROGRAM NO.-4
Write a program to find whether the person is eligible to vote or not.
age = int(input("Enter your Age: "))
if age >= 18:
print("Eligible to Vote")
else:
print("Not Eligible to Vote")
PROGRAM NO.-5
Write a program to input a character and find if the given character is upper, lower, digit or special
character.
ch = input("Enter any character: ")
if 'A' <= ch <= 'Z':
print("The character is an uppercase letter.")
elif 'a' <= ch <= 'z':
print("The character is a lowercase letter.")
elif '0' <= ch <= '9':
print("The character is a digit.")
else:
print("The character is a special character.")