0

program prints multiple nums

for num in range(10,17): if num>1: for i in range(2,num): if (num % i)==0: break else: print(num) prints 11 11 11 13 13 13 15 15 15

13th Mar 2020, 11:32 PM
Houssem Elhamdi
Houssem Elhamdi - avatar
4 ответов
+ 3
You are printing num everytime num%i!=0. So all you need to do is find a way to make the output *after* the loop.
13th Mar 2020, 11:44 PM
HonFu
HonFu - avatar
+ 1
What do you want to achieve with your program?
13th Mar 2020, 11:34 PM
HonFu
HonFu - avatar
+ 1
thanks solved 😀
13th Mar 2020, 11:54 PM
Houssem Elhamdi
Houssem Elhamdi - avatar
0
printing prime numbers
13th Mar 2020, 11:36 PM
Houssem Elhamdi
Houssem Elhamdi - avatar