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

Python Operators Assignment

The document is a Python Operators Assignment designed for beginners to early intermediate learners, covering arithmetic, comparison, and logical operators, along with coding practice questions. It includes sections with specific questions that require output evaluation, program writing, and logical reasoning. The assignment aims to enhance understanding of operator precedence, comparisons, and logical conditions through practical coding exercises.

Uploaded by

vineet Tiwari
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)
5 views5 pages

Python Operators Assignment

The document is a Python Operators Assignment designed for beginners to early intermediate learners, covering arithmetic, comparison, and logical operators, along with coding practice questions. It includes sections with specific questions that require output evaluation, program writing, and logical reasoning. The assignment aims to enhance understanding of operator precedence, comparisons, and logical conditions through practical coding exercises.

Uploaded by

vineet Tiwari
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

Python Operators Assignment

Arithmetic, Comparison, and Logical Operators

Worksheet Type Target Level


Practice + coding questions Beginner to early intermediate

Sections
Suggested Use
Arithmetic (15), Comparison (15), Logical (15),
Classwork, homework, revision, viva prep
Coding (15)

Instructions
1. Solve all output-based questions without running code first.
2. For program-writing questions, write clean variable names and print meaningful output.
3. Use proper operator precedence and brackets wherever needed.
4. Try dry-running logical expressions step by step.

Python Operators Assignment Page 1


Section A - Arithmetic Operators
Covers +, -, *, /, //, %, ** and operator precedence.

Q1. Find the output: `print(17 + 8 * 2)`

Q2. Find the output: `print((17 + 8) * 2)`

Q3. Evaluate using Python rules: `25 / 4`, `25 // 4`, and `25 % 4`.

Q4. Write a Python expression to calculate the area of a rectangle with length 14 and breadth 9.

Q5. Find the value of: `2 ** 5 + 3`.

Q6. Find the output: `print(49 // 6)` and explain why it is different from `/`.

Q7. Find the remainder when 145 is divided by 12 using Python.

Q8. Write a program to take radius as input and print area of a circle.

Q9. Find the output: `print(5 + 2 ** 3 * 2)`.

Q10. Write a program to convert total minutes into hours and remaining minutes.

Q11. Find the output: `print(50 - 18 / 3)`.

Q12. Write an expression to find the average of 45, 67, and 88.

Q13. Find the output: `print(7 % 3 + 9 // 2)`.

Q14. Write a program to swap two numbers using arithmetic operators only.

Q15. Create a simple bill calculator that takes price and quantity, then adds 18% GST.

Python Operators Assignment Page 2


Section B - Comparison Operators
Covers ==, !=, >, <, >=, <= and chained comparisons.

Q1. Find the output: `print(10 > 7)`.

Q2. Find the output: `print(15 == 15.0)`.

Q3. Find the output: `print(9 != 4)`.

Q4. Find the output: `print(12 <= 11)`.

Q5. Compare two numbers entered by the user and print which one is greater.

Q6. Write a program to check whether a student has passed if marks are greater than or equal to 35.

Q7. Find the output: `print(8 < 12 < 20)`.

Q8. Find the output: `print(5 == '5')` and explain why.

Q9. Write a program to check whether a number lies between 10 and 50.

Q10. Find the output: `print(7 >= 7)` and `print(7 > 7)`.

Q11. Write a program to compare ages of two people and print whether both are of the same age.

Q12. Find the output: `print(100 != 100)`.

Q13. Write a program to check whether a year entered is exactly 2026.

Q14. Find the output: `print(3.5 < 4)` and `print(3.5 == 3.50)`.

Q15. Write a program to check whether a number is positive, negative, or zero using comparison
operators.

Python Operators Assignment Page 3


Section C - Logical Operators
Covers and, or, not, short-circuit behavior, and mixed conditions.

Q1. Find the output: `print(True and True)`.

Q2. Find the output: `print(True and False)`.

Q3. Find the output: `print(False or True)`.

Q4. Find the output: `print(not True)`.

Q5. Write a program to check whether a person is eligible to vote if age is greater than or equal to 18
and citizenship is Indian.

Q6. Find the output: `print(10 > 5 and 8 < 3)`.

Q7. Find the output: `print(7 == 7 or 9 < 2)`.

Q8. Write a program to check if a number is between 1 and 100 using `and`.

Q9. Write a program to check whether a character is a vowel using multiple `or` conditions.

Q10. Find the output: `print(not (6 > 3))`.

Q11. Find the output: `print(0 and 5)`.

Q12. Find the output: `print(0 or 5)`.

Q13. Write a login checker where access is granted only if username is correct and password is correct.

Q14. Write a program to check whether a student gets a scholarship if marks are above 85 or sports
quota is true.

Q15. Find the output: `print((5 > 2 and 8 > 3) or False)`.

Python Operators Assignment Page 4


Section D - Coding Practice
Write full Python programs for the following problems.

Q1. Write a program to take two numbers and print their sum, difference, product, quotient, floor
quotient, and remainder.

Q2. Write a program to calculate simple interest using `P * R * T / 100`.

Q3. Write a program to input three numbers and print the largest using comparison operators.

Q4. Write a program to check whether a number is even and positive using arithmetic + logical
operators.

Q5. Write a program to check whether a person is eligible for a driving license if age >= 18 and
eyesight_test is True.

Q6. Write a program to compare two exam scores and print `Equal`, `First is greater`, or `Second is
greater`.

Q7. Write a program to check whether a given number is divisible by both 3 and 5.

Q8. Write a program to calculate total marks of 5 subjects and print whether the student passed,
assuming each subject mark is >= 35.

Q9. Write a program to check whether a year is leap year using logical operators.

Q10. Write a program to build a mini calculator using `+`, `-`, `*`, `/`, `//`, `%`, and `**` based on user
choice.

Q11. Write a program to check whether a temperature is in a comfortable range (20 to 30 inclusive).

Q12. Write a program to validate login where username is `admin` and password is `python123`.

Q13. Write a program to check whether a person is eligible for a discount if age > 60 or membership is
True.

Q14. Write a program to take three numbers and check whether all three are equal.

Q15. Write a program to read a number and print whether it is a two-digit number using comparison +
logical operators.

Python Operators Assignment Page 5

You might also like