|
| 1 | + |
| 2 | +# Python Operators Assignment |
| 3 | + |
| 4 | +In this assignment, you will explore various Python operators and their usage. Please complete the following tasks. |
| 5 | + |
| 6 | +## Task 1: Arithmetic Operators |
| 7 | + |
| 8 | +1. Create two variables `a` and `b` with numeric values. |
| 9 | +2. Calculate the sum, difference, product, and quotient of `a` and `b`. |
| 10 | +3. Print the results. |
| 11 | + |
| 12 | +## Task 2: Comparison Operators |
| 13 | + |
| 14 | +1. Compare the values of `a` and `b` using the following comparison operators: `<`, `>`, `<=`, `>=`, `==`, and `!=`. |
| 15 | +2. Print the results of each comparison. |
| 16 | + |
| 17 | +## Task 3: Logical Operators |
| 18 | + |
| 19 | +1. Create two boolean variables, `x` and `y`. |
| 20 | +2. Use logical operators (`and`, `or`, `not`) to perform various logical operations on `x` and `y`. |
| 21 | +3. Print the results. |
| 22 | + |
| 23 | +## Task 4: Assignment Operators |
| 24 | + |
| 25 | +1. Create a variable `total` and initialize it to 10. |
| 26 | +2. Use assignment operators (`+=`, `-=`, `*=`, `/=`) to update the value of `total`. |
| 27 | +3. Print the final value of `total`. |
| 28 | + |
| 29 | +## Task 5: Bitwise Operators (Optional) |
| 30 | + |
| 31 | +1. If you are comfortable with bitwise operators, perform some bitwise operations on integer values and print the results. If not, you can skip this task. |
| 32 | + |
| 33 | +## Task 6: Identity and Membership Operators |
| 34 | + |
| 35 | +1. Create a list `my_list` containing a few elements. |
| 36 | +2. Use identity operators (`is` and `is not`) to check if two variables are the same object. |
| 37 | +3. Use membership operators (`in` and `not in`) to check if an element is present in `my_list`. |
| 38 | +4. Print the results. |
| 39 | + |
| 40 | + |
0 commit comments