Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you make this code print the number of values in the range? So if the prime numbers between 4 and 10 are 5 and
Can you make this code print the number of values in the range? So if the prime numbers between 4 and 10 are 5 and 7, I want it to print out that there are 2 prime numbers in the range. Any thoughts?
lower = int(input("Enter lower range: ")) upper = int(input("Enter upper range: "))
print("Prime numbers between",lower,"and",upper,"are:")
for num in range(lower,upper + 1): # prime numbers are greater than 1 if num > 1: for i in range(2,num): if (num % i) == 0: break else: print(num)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started