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')

9th Feb 2020, 5:50 PM
Radhey
Radhey - avatar
5 odpowiedzi
+ 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)
9th Feb 2020, 6:24 PM
Diego
Diego - avatar
+ 2
Thanks everyone
9th Feb 2020, 7:37 PM
Radhey
Radhey - avatar
+ 1
Can you give an example of input and expected output?
9th Feb 2020, 6:03 PM
Gabriel Ilie
Gabriel Ilie - avatar
+ 1
yes , suppose we if want to find the prime numbers between 3 to 9. input=3,9 Than output should be= 5,7
9th Feb 2020, 6:11 PM
Radhey
Radhey - avatar
+ 1
Diego’s answer is correct. And like in his code you must delete the ‘ from print(‘nums’)
9th Feb 2020, 6:36 PM
Gabriel Ilie
Gabriel Ilie - avatar