Class 7 Computer Science Python Application Questions | Variables, If-Else, Loops & Operators (Set 1 & 2) – Answer Key

ANSWER KEY SET 1 – APPLICATION QUESTIONS

Q1.

bill = float(input("Enter bill amount: "))
if bill > 1000:
    discount = bill * 0.10
    final_price = bill - discount
    print("Final price after discount:", final_price)
else:
    print("Final price:", bill)

Q2.

age = int(input("Enter age: "))
if age >= 12:
    print("Eligible for quiz")
else:
    print("Not eligible")

Q3.

for num in range(1, 21):
    if num % 3 == 0:
        print(num)

Q4.

password = input("Enter password: ")
if len(password) >= 8 and "@" in password:
    print("Strong password")
else:
    print("Weak password")

Q5.

runs = []
for i in range(5):
    score = int(input("Enter runs of player " + str(i+1) + ": "))
    runs.append(score)

print("Total Team Score:", sum(runs))

ANSWER KEY SET 2 – MEDIUM LEVEL


Q1.

age = int(input("Enter age: "))
if age < 12:
    print("Ticket Price: ₹100")
elif age < 60:
    print("Ticket Price: ₹150")
else:
    print("Ticket Price: ₹120")

Q2.

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("Largest number is:", a)
elif b >= a and b >= c:
    print("Largest number is:", b)
else:
    print("Largest number is:", c)

Q3.

bill = float(input("Enter bill amount: "))
if bill > 2000:
    final = bill - (bill * 0.20)
elif bill >= 1000:
    final = bill - (bill * 0.10)
else:
    final = bill
print("Final amount:", final)

Q4.

num = int(input("Enter a number: "))
for i in range(1, 11):
    print(num, "x", i, "=", num * i)

Q5.

marks = []
for i in range(6):
    m = int(input("Enter marks of student " + str(i+1) + ": "))
    marks.append(m)

avg = sum(marks) / len(marks)
count = 0
for m in marks:
    if m >= 50:
        count += 1

print("Average Marks:", avg)
print("Number of students with marks >= 50:", count)

Leave a Reply

Discover more from Abhyas

Subscribe now to keep reading and get access to the full archive.

Continue reading