+ 1

Please check my code, where is the error and can remove ??

lower = int(input("enter lower range:")) upper = int(input("enter upper range:")) for num in range(lower, upper+1): if num > 1: for i in range (2,num): if (num % i) == 0: break else : print (num)

26th Nov 2017, 7:16 PM
TrAnSLIMit
TrAnSLIMit - avatar
6 ответов
+ 2
lower = int(input("enter lower range:")) upper = int(input("enter upper range:")) for num in range(lower, upper+1): if num > 1: for i in range (2,num): if (num % i) == 0: break else : print (num) OR lower = int(input("enter lower range:")) upper = int(input("enter upper range:")) for num in range(lower, upper+1): if num > 1: for i in range (2,num): if (num % i) == 0: break else : print (num) I can't get what your trying to do... so I can't know hiw it should be indented.
27th Nov 2017, 3:08 PM
Cat🐈
Cat🐈 - avatar
+ 1
For one, the indentations are off... your for loop is indented and your if block is dedented, whereas I believe your intention was to run the 'if' inside the for loop... same is the case with second for loop and if/ else
26th Nov 2017, 7:30 PM
Anil
Anil - avatar
+ 1
it is generally a good idea to describe in which way the code is not right, and what you expect instead..:-)
26th Nov 2017, 7:55 PM
ifl
ifl - avatar
+ 1
the indentation in your example code here is not right
26th Nov 2017, 7:55 PM
ifl
ifl - avatar
0
how can I remove this indentation??
26th Nov 2017, 7:57 PM
TrAnSLIMit
TrAnSLIMit - avatar
0
lower = int(input("enter lower range:")) upper = int(input("enter upper range:")) for num in range(lower, upper+1): if num > 1: for i in range (2,num): if (num % i) == 0: break else : print (num)
26th Nov 2017, 8:03 PM
TrAnSLIMit
TrAnSLIMit - avatar