generate functionThu, 09 Mar 2023

Let's iterate over all the numbers from a to b inclusive and display them on the screen, while the following conditions must be met: skip (do not display) numbers that are divisible by 2 or 3 if you meet a number that is a multiple of 777, you must force the loop to end, do not print this number itself

def foo(a, b): for i in range(a, b + 1): if (i % 2 or i % 3 or i % 777 == 0): continue print(i) foo(1, 777)

Questions about programming?Chat with your personal AI assistant