■ Python Programming
Operators · Flowcharts · Pseudocode
Complete Worksheet Collection • 10 Sets • 100+ Problems
Contents
Problem
Set Topic s
1 Arithmetic Operators – Basics, Variables, BODMAS 30
2 Comparison (Relational) Operators 20
3 Logical Operators – and / or / not 20
4 Assignment Operators 20
5 Mixed Operators (All Types) 10
6 Flowcharts 8
7 Pseudocode Writing 8
8 Mixed Large Assignment 5
9 Arithmetic Puzzles 5
10 Real-Life Mixed Operator Problems 5
WORKSHEET SET 1 — Arithmetic Operators
1.1 — Basic Arithmetic
Question Answer
print(15 + 6) 21
print(20 - 8) 12
print(7 * 6) 42
print(25 / 4) 6.25
print(25 // 4) 6
print(25 % 4) 1
print(2 ** 5) 32
print(10 + 3 * 2 ** 2) 22 (10 + 3×4)
print((10 + 3) * 2 ** 2) 52 (13×4)
print(17 % 5 + 8 // 3) 4 (2 + 2)
1.2 — Arithmetic with Variables
Question Answer
a = 12; b = 5; print(a + b) 17
x = 9; y = 2; print(x // y) 4
p = 7; q = 3; print(p % q) 1
r = 4; s = 3; print(r ** s) 64
m = 15; n = 6; print(m - n * 2) 3 (15 - 12)
u = 10; v = 3; print(u % v + u // v) 4 (1 + 3)
c = 8; d = 12; print((c + d) / 4) 5.0
e = 5; f = 2; print(e ** f + e * f) 35 (25 + 10)
g = 20; h = 7; print(g % h * 2) 12 (6×2)
i = 9; j = 2; print(i // j ** 2) 2 (9 // 4)
1.3 — BODMAS / PEMDAS Practice
Question Answer
3 + 4 * 5 23
Question Answer
(3 + 4) * 5 35
100 / 5 // 2 10.0
2 ** 3 ** 2 512 (right-to-left: 3²=9, then
2■)
25 - 5 * 2 + 8 / 4 17 (25-10+2)
(25 - 5) * 2 + 8 / 4 42 (20×2 + 2)
9 % 4 + 6 // 2 4 (1 + 3)
(9 % 4 + 6) // 2 3 (7//2)
5 * 2 ** 3 40 (5×8)
(5 * 2) ** 3 1000 (10³)
WORKSHEET SET 2 — Comparison (Relational) Operators
2.1 — True / False Basics
Question Answer
print(5 > 3) True
print(7 < 2) False
print(4 >= 4) True
print(9 <= 5) False
print(10 == 10) True
print(8 != 8) False
print(3 + 5 == 8) True
print(2 * 3 > 5 + 1) False (6 > 6)
print(12 // 4 == 3) True
print(8 % 3 != 2) False (2 ≠ 2 is False)
2.2 — Comparison with Variables
Question Answer
a = 10; b = 20; print(a < b) True
p = 15; q = 15; print(p >= q) True
x = 7; y = 9; print(x == y - 2) True (7 == 7)
m = 25; n = 5; print(m % n == 0) True
u = 12; v = 5; print(u // v == 2) True (12//5=2)
r = 6; s = 4; print(r * s <= 25) True (24 ≤ 25)
c = 18; d = 6; print(c / d == 3.0) True
e = 9; f = 2; print(e % f > 1) False (1 > 1 is False)
g = 8; h = 3; print(g ** h != 512) False (512 ≠ 512 is False)
i = 20; j = 4; print(i - j * 2 == 12) True (20-8=12)
WORKSHEET SET 3 — Logical Operators
3.1 — and / or / not
Question Answer
print(True and True) True
print(True and False) False
print(False or True) True
print(not True) False
print(5 > 3 and 8 < 10) True
print(4 > 6 or 2 == 2) True
print(not (7 <= 3)) True
print( (3+2 == 5) and (4*2 == 9) ) False
print( (10//3 == 3) or (5%2 == 1) ) True
print(not (6%2 == 0) or (7>4)) True
3.2 — Logical with Comparison
Question Answer
age=25; print(age>=18 and age<=60) True
score=85; print(score>90 or score<50) False
num=7; print(not (num % 2 == 0)) True
x=10; y=20; print(x>5 and y<30) True
a=8; b=3; print(a//b==2 or a%b==1) True (2==2 or 2==1 → True)
temp=30; print(not (temp > 25)) False
marks=45; print(marks>=40 and marks<50) True
light="red"; print(light=="green" or False
light=="yellow")
year=2024; print((year%4==0 and True
year%100!=0) or year%400==0)
day="Sunday"; print(day=="Saturday" or True
day=="Sunday")
WORKSHEET SET 4 — Assignment Operators
4.1 — Basic Assignment
Question Answer
a = 5; print(a) 5
b = 10; b += 3; print(b) 13
c = 7; c -= 2; print(c) 5
d = 4; d *= 3; print(d) 12
e = 20; e /= 4; print(e) 5.0
f = 17; f //= 5; print(f) 3
g = 15; g %= 4; print(g) 3
h = 2; h **= 5; print(h) 32
i = 6; i += 2 * 3; print(i) 12 (6 + 6)
j = 8; j %= 3 + 1; print(j) 0 (8 % 4)
4.2 — Multiple Assignments
Question Answer
x = 2; x *= 3 + 4; print(x) 14 (2×7)
y = 9; y -= 2 ** 2; print(y) 5 (9-4)
z = 12; z //= 5; z += 2; print(z) 4 (2+2)
p=5; q=3; p,q=q,p; print(p,q) 3 5
a=b=c=4; c*=2; print(a,b,c) 4 4 8
m=10; m %= 6+2; print(m) 2 (10%8)
r=7; r += r*2; print(r) 21 (7+14)
s=3; s **= 2+1; print(s) 27 (3³)
t=16; t//=3; t*=2; print(t) 10 (5×2)
u=5; v=2; u,v=v,u+v; print(u,v) 2 7
WORKSHEET SET 5 — Mixed Operators (All Types)
Question Answer
(5+3) > (2*3) and not (4==4) False
x=12; x%=5; print(x>2 or x<1) False (x=2; both conds False)
a=7; b=3; print(a//b==2 and a%b==1) True
val=3; val+=5; print(val==8 and val*2>15) True (8==8 and 16>15)
p=10; q=20; print(p>5 or q<15 and p==10) True
num=15; print(not(num%3==0) or num//5==3) True (False or True)
m=4; n=6; m*=n//2; print(m>10 and n<10) True (m=12>10 and 6<10)
x=9; y=2; z=x%y+y**2; print(z==6) False (1+4=5 ≠ 6)
(8+2*3) >= (4**2) or (12//5 == 2) True (14≥16 False; 2==2 True)
a=6;b=2;a-=3;b+=a;print(a==b and a>b) False (a=3, b=5)
WORKSHEET SET 6 — Flowcharts
6.1 — Describe the flowchart for each scenario
# Scenario Flowchart Description
1 Input a number. If > 0, print 'Positive'. Start → Input num → num>0? → Yes→Print 'Positive'→End; No→End
2 Input two numbers. Output the larger. Start → Input a,b → a>b? → Yes→Output a→End; No→Output b→End
3 Print 1 to 5 using a loop. Start → i=1 → i≤5? → Yes→Print i, i++→Loop; No→End
4 If age≥18 print 'Adult', else 'Minor'. Start → Input age → age≥18? → Yes→Adult→End; No→Minor→End
5 marks≥90→A, else ≥75→B, else C. Start → Input marks → ≥90?→A; elif ≥75?→B; else→C → End
6.2 — Pseudocode + Flowchart for each problem
Problem: Even or Odd
Pseudocode Flowchart Description
START Start → Input num → num%2==0? →
INPUT num Yes:'Even'; No:'Odd' → End
IF num % 2 == 0 THEN
PRINT 'Even'
ELSE
PRINT 'Odd'
ENDIF
END
Problem: Sum of first N natural numbers
Pseudocode Flowchart Description
START Start→Input
INPUT N N→sum=0,i=1→i≤N?→Yes:sum+=i,i++→Loop;
sum = 0, i = 1 No:Print sum→End
WHILE i ≤ N
sum = sum + i
i = i + 1
ENDWHILE
PRINT sum
END
Problem: Leap Year check
Pseudocode Flowchart Description
START Start→Input year→compound
INPUT year decision→Yes:'Leap'; No:'Not Leap'→End
IF (year%4==0 AND year%100!=0)
OR year%400==0 THEN
PRINT 'Leap'
ELSE
PRINT 'Not Leap'
ENDIF
END
WORKSHEET SET 7 — Pseudocode Writing
7.1 — Convert Python code to pseudocode
Python Pseudocode
a=int(input()); b=int(input()) START
print(a+b) INPUT a, b
sum = a + b
OUTPUT sum
END
Python Pseudocode
x=5 START
if x>0: print('pos') x = 5
else: print('neg') IF x > 0 THEN
OUTPUT 'pos'
ELSE
OUTPUT 'neg'
ENDIF
END
Python Pseudocode
for i in range(1,4): print(i*2) START
FOR i = 1 TO 3 STEP 1
OUTPUT i*2
ENDFOR
END
Python Pseudocode
n=1 START
while n<=3: n = 1
print(n) WHILE n ≤ 3
n+=1 OUTPUT n
n = n + 1
ENDWHILE
END
7.2 — Write pseudocode for:
Problem: Input 3 numbers and output the largest.
START
INPUT a, b, c
IF a≥b AND a≥c THEN large = a
ELSE IF b≥a AND b≥c THEN large = b
ELSE large = c
OUTPUT large
END
Problem: Print multiplication table of a number (1–10).
START
INPUT num
FOR i = 1 TO 10
OUTPUT num, '×', i, '=', num*i
ENDFOR
END
Problem: Count digits of a positive integer.
START
INPUT n
count = 0
WHILE n > 0
n = n // 10
count = count + 1
ENDWHILE
OUTPUT count
END
Problem: Check if a character is vowel or consonant.
START
INPUT ch
IF ch ∈ {a,e,i,o,u,A,E,I,O,U} THEN
OUTPUT 'Vowel'
ELSE
OUTPUT 'Consonant'
ENDIF
END
WORKSHEET SET 8 — Mixed Large Assignment
Q1 — Write Python expressions
a) Add 5 to x, then multiply by 3.
b) Check if a > b and c < d.
c) Assign remainder of x÷7 to y, then add 2 with assignment operator.
Answer:
a) (x + 5) * 3
b) a > b and c < d
c) y = x % 7; y += 2
Q2 — Flowchart: factorial of N
Draw a flowchart to find N! = N × (N-1) × … × 1.
Answer:
Start → Input N → fact=1, i=1 → i≤N? → Yes:fact*=i, i++ →Loop; No:Print fact→End
Q3 — Pseudocode: reverse a 3-digit number
Write pseudocode to reverse a 3-digit number (e.g. 123 → 321).
Answer:
START
INPUT num
d1 = num // 100
d2 = (num // 10) % 10
d3 = num % 10
rev = d3*100 + d2*10 + d1
OUTPUT rev
END
Q4 — Evaluate
(12 > 8 or 5*2 == 9) and not (3**2 == 10)
Answer:
(True or False)→True; (9==10)→False; not False→True; True and True → True
Q5 — Step-by-step assignments
Start: a=10, b=3, c=2.
Step 1: a += b * c
Step 2: b //= c
Step 3: c **= b
Print a, b, c.
Answer:
Step 1: a = 10+(3×2) = 16
Step 2: b = 3//2 = 1
Step 3: c = 2**1 = 2
Output: 16 1 2
WORKSHEET SET 9 — Arithmetic Puzzles
Question Answer
(25 // 3) * (14 % 5) 8 × 4 = 32
(2 + 3) * 4 - (8 // 3) 20 - 2 = 18
((9 % 4) ** 2) * (15 // 4) (1**2) × 3 = 3
(64 ** 0.5) + (27 ** (1/3)) 8.0 + 3.0 = 11.0
print( (100 // 20) + (100 % 20) ) 5 + 0 = 5
WORKSHEET SET 10 — Real-Life Mixed Operator Problems
# Problem Answer
1 Attendance=75%, marks=40. Pass if marks≥40 AND attendance≥75.
marks>=40 Is
and attendance>=75 → True
it True?
2 price -= price * 0.10 → 1080.0
price=1200. 10% discount if >1000 else 5%. Apply and print.
3 Pseudocode for BMI = weight / height² START
INPUT weight, height
bmi = weight / (height**2)
OUTPUT bmi
END
4 Flowchart: equilateral / isosceles / scalene given 3 sides. Start→Input a,b,c→a==b==c?→Equilateral; elif any two equal→Isosceles; else
5 Check if a number is between 10 and 20 (inclusive). num=15; print(10 <= num <= 20) → True
Python Operators · Flowcharts · Pseudocode — Complete Worksheet Collection | 10 Sets | 100+ Problems | Q&A; Side-by-Side