Question: Here is another algorithm for discovering prime integers. A prime number is an integer greater than 1 whose only factors are 1 and itself. Rewrite

Here is another algorithm for discovering prime integers. A prime number is an integer greater than 1 whose only factors are 1 and itself.
Rewrite this code as a user defined function. The function will take two arguments specifying range of integers to be considered, the first argument being the lower and the second being the upper.
Be sure to use this algorithm and not some other.
The function will return a list of prime integers within the specified range. For example, if your function is passed 2 and 50 as arguments, it will return this list:
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47
If it is passed 100 and 150 as arguments, it will return
[101,103,107,109,11127,131,137,139,149]
Here is the code to be adapted as a user defined function:
for i in range (2,50) :
if i=0 or i=1 :
continue
else:
for j in range(2, int (i2)+1 :
if i%j=0 :
else:
break
print(i)
 Here is another algorithm for discovering prime integers. A prime number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!