+ 8

Can anyone explain what's going on this python code??

how is this output possible??? can anyone explain??? for n in range(2,10): for x in range(2,n): if n%x==0: break else: print(n,end=' ') output is 2357 but how??

16th Apr 2018, 2:41 PM
Shadow Windster
Shadow Windster - avatar
2 Réponses
+ 3
Look at this code. I have added a few print statements so that you can see very clearly what is going on at each step. I often use print() to debug... If you look out the ouput and still do not understand what is going on let me know ☺ https://code.sololearn.com/c3EvVv8F7d16/?ref=app
16th Apr 2018, 4:42 PM
cyk
cyk - avatar
+ 9
@cyk it's really helpful! thanks for your help
16th Apr 2018, 5:15 PM
Shadow Windster
Shadow Windster - avatar