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 f(a,b): for i in range(a,b + 1): if i%2 == 0 or i%3 == 0 or i%777 == 0: continue print(i) if i%777 == 0: break f(1, 10)

Questions about programming?Chat with your personal AI assistant