Page 263 - Ai_V1.0_Class9
P. 263
C. Write Python code for the given instructions.
1. Input three angles and check whether they form a triangle or not.
2. Input time in seconds and change it into minutes.
3. Find the result of 22/7 * 5 * 5 i.e. the area of a circle having a radius of 5. [CBSE Handbook]
4. Input length and breadth and display whether it is a square or not.
5. Input a number between 1 and 7 and display the weekday based on the number entered.
6. Take a Boolean value “False” and a float number “15.6” and perform the AND operation on both. [CBSE Handbook]
7. Input Salary and Years of Service. If the number of years is more than 5 then give an extra bonus of 15%. Display the
net salary after adding the bonus.
8. Take a string “Zero” and a Boolean value “True” and try adding both by using the Bool () function. [CBSE Handbook]
9. Input the billing amount of shopping done. If the amount is more than 5000 then give a discount of 10%. Display the
net billing amount after the discount.
10. Take a Boolean value and add a string to it. [CBSE Handbook]
11. Take a string “Morning “and the float value “90.4” and try and add both of them by using the float () function.
[CBSE Handbook]
Lab #Computational Thinking
1. Write an algorithm for calculating the Net salary of a person (Net Salary=Basic + Allowances – Deductions).
Take the Basic, Allowances and Deductions as input.
2. Write an algorithm to print the larger of the two marks taken an input. Also, draw a flowchart.
3 Write a Python program to:
a. Convert Celsius to Fahrenheit using the formula: (Celsius * 1.8) + 32
b. Input five names from the user and print them in the same line with a single space.
c. Swap the values of two variables using the third variable.
d. Convert kilometre unit to metre.
e. Calculate the area of a square.
f. Interchange the values of the adjacent elements of the list. Print the updated list.
g. Input five names of cities in a list. Accept a name and check whether it exists in a list or not. Display
an appropriate message.
Introduction to Python 261

