0
numbers of prime number between certain range?not getting output?
lower=int(input('enter a lower number')) upper=int(input('enter a upper number')) for nums in range(lower,upper+1): if nums>1: for i in range(2,nums): if (nums%i==0): break; else: print('nums')
5 Antworten
+ 3
Give the "else" block an extra level of indentation.
for nums in range(lower,upper+1):
if nums>1:
for i in range(2,nums):
if (nums%i==0):
break
else:
print(nums)
+ 2
Thanks everyone
+ 1
Can you give an example of input and expected output?
+ 1
yes , suppose we if want to find the prime numbers between 3 to 9.
input=3,9
Than output should be= 5,7
+ 1
Diego’s answer is correct. And like in his code you must delete the ‘ from print(‘nums’)