What i have tried :
for num in range(2,50):
prime = True
for i in range(2,num):
if (num%i==0):
prime = False
if prime:
print (num)
The result were fine but its prohibited to use for or while loops in any way so, is there any other way to do it without using for or while loops?