KEMBAR78
Class 11 CS - Assignment | PDF | Python (Programming Language) | Computing
0% found this document useful (0 votes)
16 views2 pages

Class 11 CS - Assignment

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)
16 views2 pages

Class 11 CS - Assignment

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/ 2

BASICS OF PYTHON- PRACTICE QUESTIONS

1. Write a program to calculate Simple Interest.

2. Write a program to input marks of 5 subjects and calculate total, average, and percentage.

3. Write a program to swap two variables without using a third variable.

4. Write a program to convert temperature from Celsius to Fahrenheit.

5. Write a program to calculate BMI = Weight / Height².

6. Write a program to compute the perimeter and area of a rectangle.

7. Write a program to compute speed given distance and time.

8. Predict the output of:


x=5
y=2
print(x ** y)
print(x % y)

9. Predict the output of the following code and explain each step:
x=5
y=2
expr1 = x ** y + x // y - x % y
expr2 = (x + y) * (x - y) / y
print(expr1)
print(expr2)

10. Predict the output of the following code

x = True
y = False
print(x and y, x or y, not x)
11. ABC school wants to develop a simple Python script to store a student’s name, roll number,
and marks in three subjects. They also want to calculate the average marks and check if the
student has passed (pass mark is 33 in each subject).

Questions:

i. Identify the appropriate data types for:


a. Student name
b. Roll number
c. Marks
ii. Write a Python code to store the above data and calculate average marks.
iii. Use operators to check if the student passed in all subjects.
iv. What error will occur if a string is added to an integer in the marks calculation? Show how
to correct it.
12. Rehan wants to create an employee salary calculator which takes basic salary and calculates
HRA (20%) and DA (50%), then calculates the gross salary.

Gross Salary = Basic Salary+HRA+DA


Questions:

i. Define variables to store basic salary, HRA, and DA.


ii. Write the code to calculate gross salary.
iii. Which operator will be used if we don’t want decimal values?
iv. Identify and fix the error if someone mistakenly writes
HRA = basic_salary * 20/100%.
13. Case Study:
A school canteen sells snacks in boxes. Each box contains a fixed number of items. The school
wants to maintain a small Python program to calculate sales.

# Canteen sales program


boxes = 47
items_per_box = 6
price_per_item = 12
total_items = boxes * items_per_box
full_cartons = total_items // 25
remaining_items = total_items % 25
total_price = total_items * price_per_item
Questions:

i. What is the value of total_items?


ii. How many full cartons (full_cartons) of 25 items each can be made?
iii. What will be the number of remaining_items after forming full cartons?
iv. What is the total price (total_price) of all items?
14. An e-commerce company calculates discounts and shipping costs using Python code.

items = 13
price_per_item = 250
discount = 0.1 # 10% discount
shipping_fee = 150

total_price = items * price_per_item


discounted_price = total_price - (total_price * discount)
final_amount = discounted_price + shipping_fee
free_shipping = final_amount > 3000

i. What is the value of total_price?


ii. Find the discounted_price.
iii. What will final_amount be after adding shipping charges?
iv. What will be the Boolean value of free_shipping?

You might also like