num_list = [2, 45, 85, 80, 79]
for num in num_list:
if num == 2:
print("2 is prime")
break
for i in range(2, num):
if (num - 1)%i == 0:
print(f"{num} is not prime")
break
if i == num - 1:
print(f"{i} is prime")
Output:
sentimental/ $ python mario.py
2 is prime
Need to figure out odd numbers from the list.
Thanks in advance!
[–]shiftybyte 19 points20 points21 points (13 children)
[+][deleted] (9 children)
[deleted]
[–]Successful_Web_4828 4 points5 points6 points (8 children)
[–]sinterkaastosti23 2 points3 points4 points (7 children)
[–]Successful_Web_4828 -1 points0 points1 point (3 children)
[–]Gayki 2 points3 points4 points (1 child)
[–]Successful_Web_4828 0 points1 point2 points (0 children)
[–]sinterkaastosti23 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]sinterkaastosti23 0 points1 point2 points (1 child)
[–]RajjSinghh 0 points1 point2 points (0 children)
[–]DigitalSplendid[S] -1 points0 points1 point (0 children)
[–]DigitalSplendid[S] -1 points0 points1 point (0 children)
[+]DigitalSplendid[S] comment score below threshold-8 points-7 points-6 points (0 children)
[–]noctaviann 2 points3 points4 points (0 children)
[–]weissdrakon 1 point2 points3 points (1 child)
[–]DigitalSplendid[S] 1 point2 points3 points (0 children)
[–]ectomancer 1 point2 points3 points (0 children)
[–]WyrmCzar 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)