CLO2
Q1: Choose the suitable Data Type: (Float, Integer, String, Boolean, Complex)
- The balance of bank accounts
- Year of birth
- Course code (ICT 2013)
- Patient Temperature
- Submit the assignment (Yes, No)
Q2: Identify which of the below variables is valid or not:
- my-rank
- as
- your age
- a
- totalprice
- 2ndrank
Q3: Which naming conversion fits the variable name? (lower, upper, camel, mixed, snake)
- price
- redBoxLength
- QUANTITY
- tax_amout
- BirthPlace
Q4: Convert the following mathematical expression to Python expression:
𝟏
- 𝟐
𝝅𝒓𝟐 (𝝅=𝟑.𝟏𝟒)
𝒅(𝟑×𝟑)
- 𝒙
𝒏
𝟒𝟐 − 𝒄
- 𝟐𝒙
𝟒𝟐 − 𝟑𝒂𝒄
- 𝟐𝒂
Q5: Simplify the Python expression (find the solution):
15 + 12 / (4 ** 2 – 4) * 2 ** 2 % 5
1.
2.
3.
4.
5.
6.
7.
Q6: Find the average weight. The program asks the user to enter the weights of 2
people. Complete the program by filling in the blanks.
# Read the weight of two people
# And convert it to the appropriate type
weight1 = ____________ (“Enter the weight of first person: “)
weight1 = ________ (weight1)
weight2 = ____________ (“Enter the weight of second person: “)
weight2 = ________ (weight2)
# Calculate the average weight
average_weight = __________________________________
# Display the result
___________ (“Average weight is: “ , ________________ )
CLO3
Q7: A Coaching Center provides training in Python Programming and offers discounts
based on the student's exam score.
Eligibility Test Score Discount Percentage
0 to 60 10%
61 to 70 15%
71 to 90 20%
91 to 100 25%
Write a Python program using a “Nested If” statement to calculate the discount and
total fees to be paid after the discount, based on the student's exam score. Your
program should:
a) Read the eligibility test score (between 0 and 100) of a student and the course fee.
Display an error message if the score is invalid.
b) Calculate the discount amount and the total fees after applying the discount.
c) Display the discount amount and the final fees after the discount as shown in the
example output below.
Sample Output 1: (Valid input)
Enter the exam score: 82.5
Enter the course fee: 3000
Discount offered: 600.0
Total fee after discount: 2400.0
Sample Output 2: (Invalid input)
Enter the exam score: 101
Enter the course fee: 3000
Invalid score entered
Q8: Write a Python program that asks the user to input the marks of 6 students in a
course using a loop. The program should count and display how many students
passed, how many failed and invalid mark entered. Consider the passing mark to be
60 or above.
Sample Output:
Enter student mark: 78
Enter student mark: 56
Enter student mark: 45
Enter student mark: 89
Enter student mark: 30
Enter student mark: 102
Number of students passed: 2
Number of students failed: 3
Number of invalid marks: 1