Question: Essentially in python this my code and I want this output if a range is selected 5:7!11&13:17!19&23 or just 1 number it is only one

Essentially in python this my code and I want this output if a range is selected 5:7!11&13:17!19&23 or just 1 number it is only one and finally no primes if there is no prime numbers. however I am not able to achieve it. def primenumbers(num1,num2): results = [] for num in range(num1, num2 + 1): # all prime numbers are greater than 1 if num > 1: for i in range(2, num): if (num % i) == 0: break results.append('No Primes') else: results.append(str(num)) #print(results) #results = list(map(int, results)) return results #Function to print the desired output def printOutput(result): list2 = [':', '!', '&'] output = '' for i in range(1,len(result)): output =print(str(result[i%len(result)])+list2[i%len(list2)],end = '') return output def main(): num1 = 5 num2 = 25 primenumbers(num1, num2) results = primenumbers(num1, num2) printOutput(results) if __name__ == '__main__': main() 

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!