Assignment: Python Basics - Operators & Conditional Statements
Class – 11
Informatics Practices
Section A: Operators (Calculation-Based Questions)
1. Write a Python program to take two numbers as input and perform the following
operations:
o Addition
o Subtraction
o Multiplication
o Division
o Modulus
2. Write a Python program to calculate the area and perimeter of a rectangle.
Formula:
o Area = length × breadth
o Perimeter = 2 × (length + breadth)
3. Write a Python program to swap two numbers using:
o A temporary variable
o Arithmetic operations (without using a third variable)
4. Write a Python program to calculate the simple interest using the formula:
SI=P×R×T100SI = \frac{P \times R \times T}{100}SI=100P×R×T
(where P = principal amount, R = rate of interest, T = time in years)
5. Write a Python program to calculate the average of five numbers entered by the
user.
6. Write a Python program to check whether a number is even or odd using the modulus
operator.
7. Write a Python program to convert temperature from Celsius to Fahrenheit and vice
versa.
o Fahrenheit = (Celsius × 9/5) + 32
o Celsius = (Fahrenheit - 32) × 5/9
Section B: Conditional Statements (Simple Applications)
8. Write a Python program to check whether a given number is positive, negative, or
zero.
9. Write a Python program to find the largest of three numbers entered by the user.
10.Write a Python program to check whether a given year is a leap year or not.
(A year is a leap year if it is divisible by 4 but not divisible by 100, except if it is also
divisible by 400.)
11.Write a Python program to determine whether a character entered by the user is a
vowel or a consonant.
12.Write a Python program to calculate electricity bill based on the following conditions:
For first 100 units, charge = ₹5 per unit
For next 100 units, charge = ₹7 per unit
Beyond 200 units, charge = ₹10 per unit
Display the total bill amount for the units entered by the user.
13.Write a Python program to implement a grading system based on the percentage of
marks entered by the user:
90-100% → A+
80-89% → A
70-79% → B
60-69% → C
50-59% → D
Below 50% → Fail
14.Write a Python program to check if a number is divisible by both 5 and 11.
15.Write a Python program to simulate a simple ATM withdrawal system where:
The user enters their balance and withdrawal amount.
If sufficient balance is available, deduct the amount and display the remaining
balance.
If the balance is insufficient, display an appropriate message.