Quick actions

cmd+k|ctrl+k

Navigation

Languages

30-Apr-2026 Class 7

Snippet info

Language

Python

Visibility

public

Author

michaelluiwaihung

Created

2026-04-30T11:15:39.090484Z

Updated

2026-05-04T06:23:05.446779Z

#temp 13
def a():
    print("I am from function a")
    return True
x = 1
if a():
    print("x is true")
elif x == 0:
    print("x is false then true")
else :
    print("x is false then false")
print("back to normal flow")

x = 5
while x > 0:
#while True:
      print(x)
      if x == 4:
         x = x - 1
         continue
      print("hello")
      if x == 3:
         break
      x = x - 1
else:
    print("normal exit of while")
print("after while")

#temp 14
#for i in [1,2,3,4]:
#    i = i * i
#    print(i)
for i in range(1, 20, 4):
    for j in range(5):
        print(f"j : {j}, i: {i}")
    if i == 13:
       break

try:
    x = 1
    y = 1
    if x == 1: 
       raise
    result = x/y
    print(result)
except ZeroDivisionError:
    print("second operand cannot be zero")
except TypeError as msg:
    print(msg)
except :
    print("except error")

# TypeError ZeroDivisionError
else : 
    print("no error")
finally:
    print("This line will run no matter what")

print("this line will run also")

INFO