1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kipiarov [429]
3 years ago
15

Write a program that prompts the user to enter two positive integers less than 1,000,000,000 and the program outputs the sum of

all the prime numbers between the two integers. Two prime numbers are called twin primes, if the difference between the two primes is 2 or -2. Have the program output all the twin primes and the number of twin primes between the two integers.
Computers and Technology
1 answer:
alexira [117]3 years ago
7 0

Answer:

In Python:

low = int(input("Low: "))

high = int(input("High: "))

if low >= 1000000000 or high >=1000000000:

   print("Out of range")

else:

   mylist = []

   for num in range(low,high+1):

       flag = False

       if num > 1:

           for i in range(2, num):

               if (num % i) == 0:

                   flag = True

                   break

       if not flag:

           mylist.append(num)

           print(num, end = " ")

   print()

   print("The twin primes are: ",end="")

   count = 0

   for i in range(1,len(mylist)):

       if mylist[i] - mylist[i-1] == 2:

           print(str(mylist[i])+" & "+str(mylist[i-1]),end=", ")

           count+=1

   print()

   print("There are "+str(count)+" twin primes")

Explanation:

See attachment for complete program where comments were used to explain each line

Download txt
You might be interested in
Which of the statements below explains why a budget is useful
Papessa [141]

The answer is D. All the other answers describe what a budget CAN be like, not necessarily what it is for everyone, if that makes sense.

8 0
3 years ago
You are planning to help students learn to program in Python. Some of the steps are below, but not in any particular order.
MatroZZZ [7]

The steps learn to program in Python are:

  • Define your objectives.
  • Define use case(s).
  • You draw mock-ups..
  • User enters a topic..
  • You show how each screen flows to the other screens,
  • Wireframe your app

<h3>How do one run Python on your computer.</h3>

One can do so by the us of Thonny IDE which one needs to run the installer on ones computer then one goes to  File and then a person can write Python code in the file and save it and later run it

Note that The steps learn to program in Python are:

  • Define your objectives.
  • Define use case(s).
  • User enters a topic, the app switches to a screen with an explanation. This app will help users learn to program Python. On that screen, the user can choose to see sample code.
  • You draw mock-ups of each screen and identify the input-process-output for each screen.
  • You show how each screen flows to the other screens
  • Wireframe your app.

Learn more about Python from

brainly.com/question/26497128

#SPJ1

4 0
2 years ago
How was WiFi discovered?
postnew [5]

Answer:

An Australian scientist by the name of John O'Sullivan was inspired by Stephen Hawking's theory of evaporating black holes and their subsequent radio waves. He set out to find them and prove the theory correct. (Wi-Fi was discovered on accident)

7 0
3 years ago
Test if a number grade is an A (greater than or equal to 90). If so, print "Great!". Sample Run Enter a Number: 98 Sample Output
Debora [2.8K]

Answer:

Using Python language :

a = eval ( input ( "Enter a mark please"))

if ( a <0){

print ("Invalid mark")};

else if (a >=90 && a <=100){ print

( "GREAT")};

Explanation:

7 0
3 years ago
List four types of ic packages​
Pani-rosa [81]

Answer:

C-DIP: Ceramic Dual In-line Package.

CERDIP: Ceramic DIP, which is the same as C-DIP.

CPGA: Ceramic Pin Grid Array.

DIL: Dual In-Line; see note below.

DIP: Dual In-line Package; DIP Socket Styles.

TBD: Dual In-line Zig-Zag Package; Zig-Zag Package.

HDIP: Hermetic DIP.

PDIP: Plastic DIP [P-DIP]

Explanation:

6 0
3 years ago
Other questions:
  • Automotive engine cylinder heads can be made of what?
    7·1 answer
  • The LTE (cellular telephone) standard supports only packet switching"". What cellular services are morst affected by this change
    15·1 answer
  • Effective collaboration requires a proactive and holistic strategy that integrates business goals and technology potential.
    15·1 answer
  • You've been hired as a consultant to help an online store owner. You need to complete the implementation of conversion tracking
    6·1 answer
  • Why is outfitting a workspace with video games in technology development company considered a strategic use of money
    8·2 answers
  • Solid state components are less likely to fail because they:______.a. are driven by precise sets of software instructions. b. ha
    8·1 answer
  • The router is physically located in a server room that requires an ID card to gain access. You've backed up the router configura
    8·1 answer
  • ??????????????????????????
    13·1 answer
  • Write a C Program to Print the initial letter of Name Ferdous
    14·1 answer
  • Write a function float Average(int, int) that finds the mean, and then write a main program that inputs two numbers from the use
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!