0% found this document useful (0 votes)
7 views4 pages

Python Expression Questions

The document contains a series of Python expression practice questions along with their step-by-step solutions and final outputs. Each question involves basic arithmetic operations and demonstrates the use of operators such as exponentiation, floor division, and modulus. The answers provide the final computed values for each expression.

Uploaded by

krubashinis
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)
7 views4 pages

Python Expression Questions

The document contains a series of Python expression practice questions along with their step-by-step solutions and final outputs. Each question involves basic arithmetic operations and demonstrates the use of operators such as exponentiation, floor division, and modulus. The answers provide the final computed values for each expression.

Uploaded by

krubashinis
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 Expression Practice Questions

Questions
1. x = 4
y=2
z=3
print(x ** y + z * 2 // y)

2. a = 10
b=4
c=2
print(a // b + a % c * b)

3. p = 6
q=3
r=2
print(p ** r // q + p % q)

4. x = 8
y=3
z=4
print((x + y) * z // y + x % z)

5. a = 7
b=2
c=3
print(a ** c % b + c * a // b)

6. x = 5
y=2
z=4
print((x ** y) // z + (z % y))

7. a = 12
b=5
c=3
print(a % b + (a ** c) // b)

8. x = 3
y=4
z=2
print((x + y) ** z // x + y % z)
9. p = 9
q=2
r=3
print(p ** q % r + (p // q))

10. a = 6
b=2
c=4
print(a ** b // c + (b % a))
Answers
1. Step 1: x ** y = 4 ** 2 = 16
Step 2: z * 2 = 3 * 2 = 6
Step 3: 6 // y = 6 // 2 = 3
Final: 16 + 3 = 19
Output: 19

2. Step 1: a // b = 10 // 4 = 2
Step 2: a % c = 10 % 2 = 0
Step 3: 0 * b = 0
Final: 2 + 0 = 2
Output: 2

3. Step 1: p ** r = 6 ** 2 = 36
Step 2: 36 // q = 36 // 3 = 12
Step 3: p % q = 6 % 3 = 0
Final: 12 + 0 = 12
Output: 12

4. Step 1: (x + y) = 8 + 3 = 11
Step 2: 11 * z = 44
Step 3: 44 // y = 44 // 3 = 14
Step 4: x % z = 8 % 4 = 0
Final: 14 + 0 = 14
Output: 14

5. Step 1: a ** c = 7 ** 3 = 343
Step 2: 343 % b = 343 % 2 = 1
Step 3: c * a = 3 * 7 = 21
Step 4: 21 // b = 21 // 2 = 10
Final: 1 + 10 = 11
Output: 11

6. Step 1: x ** y = 5 ** 2 = 25
Step 2: 25 // z = 25 // 4 = 6
Step 3: z % y = 4 % 2 = 0
Final: 6 + 0 = 6
Output: 6

7. Step 1: a % b = 12 % 5 = 2
Step 2: a ** c = 12 ** 3 = 1728
Step 3: 1728 // b = 1728 // 5 = 345
Final: 2 + 345 = 347
Output: 347

8. Step 1: (x + y) = 3 + 4 = 7
Step 2: 7 ** z = 7 ** 2 = 49
Step 3: 49 // x = 49 // 3 = 16
Step 4: y % z = 4 % 2 = 0
Final: 16 + 0 = 16
Output: 16

9. Step 1: p ** q = 9 ** 2 = 81
Step 2: 81 % r = 81 % 3 = 0
Step 3: p // q = 9 // 2 = 4
Final: 0 + 4 = 4
Output: 4

10. Step 1: a ** b = 6 ** 2 = 36
Step 2: 36 // c = 36 // 4 = 9
Step 3: b % a = 2 % 6 = 2
Final: 9 + 2 = 11
Output: 11

You might also like