0% found this document useful (0 votes)
33 views3 pages

Sample Python Paper Questions

The document contains sample Python programming questions, including code snippets for output prediction, flowchart creation for various scenarios, and programming tasks for calculating commissions, student marks, transportation expenses, and grocery costs. It also includes questions regarding user input and program functionality. The focus is on understanding Python syntax and logic through practical applications.

Uploaded by

sesadiperera16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views3 pages

Sample Python Paper Questions

The document contains sample Python programming questions, including code snippets for output prediction, flowchart creation for various scenarios, and programming tasks for calculating commissions, student marks, transportation expenses, and grocery costs. It also includes questions regarding user input and program functionality. The focus is on understanding Python syntax and logic through practical applications.

Uploaded by

sesadiperera16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Sample Python Paper Ques2ons

1. What is the output of the following code?

i. x=5
if x > 10:
print("Greater than 10")
elif x < 0:
print("NegaCve")
else:
print("Between 0 and 10")

ii. for i in range(5):


if i % 2 == 0:
print(i, end=" ")
else:
print("Odd", end=" ")

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.

i. Write a Python program that calculates the commission earned by a


salesperson based on the total sales amount for the month. The program
should output the commission amount according to the following criteria:

§ 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.

iii. Develop a Python program to help a user calculate their monthly


transportation expenses. The program should ask the user to input the all the
travelling costs. Based on this information, the program should calculate the
total transportation cost for the month.

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.

i. What information does the program prompt the user to input?


ii. How does the program calculate the total salary?
iii. What format does the program use to display the total salary?
iv. How does the program handle decimal values for hours worked and hourly rate?
v. What happens if the user enters non-numeric values for hours worked or hourly
rate?

You might also like