Python Classroom notes 01/Sep/2026

looping

  • Kid now knows
    • and
    • or
    • not

Sample – 1

  • Sum of all numbers from 1 to 10
result = 0
start = 1
end = 10
until start <= end
   result = result + start
   start = start + 1
say result

Sample – 2

  • Factorial of a number
number = 5
result = 1
start = 1
until start <= number:
   result = result * start
   start = start + 1
say result

Sample – 3

start = 1
end = 10
result = 0
until start < 10
    if start % 3 == 0 or start % 5 == 0
      result = result + start
    start = start + 1
say result

Sample – 4

a = 1
b = 2
result = 2
until a + b <  100
    c = a + b
    if c % 2 == 0
        result = result + c
    a = b
    b = c
say result

Exercise

  • Find if the number is prime or not

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading