Sample Python Paper Questions
Sample Python Paper Questions
i. x=5
if x > 10:
print("Greater than 10")
elif x < 0:
print("NegaCve")
else:
print("Between 0 and 10")
iii. x=7
while x > 0:
print(x, end=" ")
x -= 2
2. Flow charts
1. Create a flowchart for a program that calculates the area of a rectangle given the
length and width entered by the user.
2. Create a flowchart for a program that checks if a given number is even number or
an odd number.
3. Draw a flow chart that calculates the discount percentage for a purchase based
on the total amount spent by a customer. It should output the discount
percentage based on the following criteria:
§ If the total amount spent is greater than 1000, the discount percentage is
20%.
§ If the total amount spent is between 500 and 1000, the discount percentage
is 15%.
§ If the total amount spent is between 200 and 499, the discount percentage is
10%.
§ If the total amount spent is less than $200, the discount percentage is 5%.
3. Write Python programs.
§ If the total sales amount is less than LKR 1000, the commission rate is 5%.
§ If the total sales amount is between LKR 1000 and LKR 5000 (inclusive), the
commission rate is 7.5%.
§ If the total sales amount is greater than LKR 5000, the commission rate is
12.5%.
ii. Write a Python program that takes the marks of 7 students for the English
subject as user input. The program should calculate and print the total and
the average marks for the subject.
iv. Create a Python program to calculate the total cost of groceries purchased by
a user. The program should ask the user to enter the prices of each item one
by one. Once all prices are entered, the program should display the total
cost. Additionally, if the total cost exceeds LKR 1000, the user is eligible for a
10% discount on the total bill. Implement this discount in your program.
4. Answer the following questions using the given python code.