[go: up one dir, main page]

0% found this document useful (0 votes)
5 views2 pages

Assignment 2-Conditional Statements

This document is a Computer Science assignment for Grade 11 students at National Public School, Koramangala, covering conditional statements in Python. It includes five programming tasks: sorting three numbers, checking character types, validating triangle sides, calculating BMI, and computing income tax based on specified criteria. The assignment spans from June 25, 2024, to July 9, 2024.

Uploaded by

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

Assignment 2-Conditional Statements

This document is a Computer Science assignment for Grade 11 students at National Public School, Koramangala, covering conditional statements in Python. It includes five programming tasks: sorting three numbers, checking character types, validating triangle sides, calculating BMI, and computing income tax based on specified criteria. The assignment spans from June 25, 2024, to July 9, 2024.

Uploaded by

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

National Public School, Koramangala, 2024-25

Computer Science Assignment -2


Conditional Statements
Grade: 11
Start Date: 25.06.24 Completion Date: 09.07.24

Write programs in Python for the following (Appropriate prompts and legends to be used):

1. Input 3 numbers a, b, c from the user and display them in ascending order.
E.g.:- If a=3, b=1 and c=7 then display as: 1,3,7

2. Input a character from the user and check if it is an alphabet or not. If it is an alphabet, toggle
the case and display the same. All other characters to remain as it is.
E.g.:- Input a character: ‘a’
Expected output:
Character Input : 1
Character Entered: a
Not an alphabet, hence case not changed.
Character with case changed: A

3. Input 3 sides of a triangle a, b, c and check if they make a triangle. For a triangle to be
possible, the sum of the lengths of any two sides must be greater than the length of the third
side.
E.g.:- If a=7, b=14 and c=16 – A triangle can be formed.
If a=2, b=3, c=8 - Triangle cannot be formed.

4. Input a person’s weight in kgs and height in meters and calculate his/her BMI (Body Mass
Index). The BMI for an individual is calculated as:

weight
BMI = 2
height

a. Display his/her classification based on the BMI range as given in the table:

Classification BMI range


Underweight below 18.5
Normal 18.5 to 25
Overweight Above 25 – up to 30
Obese Above 30

b. Calculate and display the least weight in kgs a person must lose or gain to attain
normal BMI.

Test cases:

Height(m) Weight (kg) BMI Lose/gain(kg)


1.60 65 25.4 1
1.55 42 17.5 2.4
1.58 55 22 0

1
5. Input the annual income of a person from the user and calculate the tax he/she must pay, based
on the following criteria:

Income(Rs) Tax(%)
less than Rs. 2,50,000 No Tax
above Rs.2,50,000 but below Rs. 5,00,000 5% of the income above Rs. 2,50,000
above Rs. 5,00,000 but less than Rs. 10,00,000 10% of the income above Rs.500,000 + tax for
the slab Rs. 250,001 to Rs. 500,000
above Rs.10,00,000 15% of the income above Rs. 10,00,000 + tax
for the slab Rs. 5,00,001 to Rs. 10,00,000 + tax
for the slab Rs. 250,001 to Rs. 500,000

Test cases:
Annual income (in Rs.) Tax (in Rs.)
2,00,000 Nil
4,00,000 7,500
8,00,000 42,500
12,00,000 92,500

********

You might also like