Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions