Computers and Technology

Three functions are required:get_input():This function takes no parameters, but will ask the user for an integer number. It will return a valid integer. You will use an indefinite loop and exception handling like we discussed in class. It is required to catch user input error and gracefully recover. Learn about the continue keyword and how it works in a loop; it can be handy. is_prime(n):This function will take an integer parameter n, and return True if the number is prime, or return False if it is not prime. You can use this pseudocode for primality testing to write this function. main():This does the bulk of your program’s work for solving Goldbach’s conjecture. You will call get_input() and is_prime(n) from main().Goldbach’s conjecture itself will be solved using an indefinite loop. Particularly a ‘post-test’ loop pattern. A for loop will not be accepted as part of the solution. OutputA successful run:This program tests the Goldbach's conjecturePlease enter an even integer larger than 2: 3636 = 5 + 31A run recovering from errors:This program tests the Goldbach's conjecturePlease enter an even integer larger than 2: 7Wrong input!Please enter an even integer larger than 2: fooBad input!Please enter an even integer larger than 2: 88 = 3 + 5If by chance the number chosen is valid, but doesn’t hold for Goldbach’s conjecture, then print:Goldbach's conjecture doesn't hold for [whatever the number is]

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 11:00, swelch2010
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
image
Computers and Technology, 24.06.2019 01:00, kkruvc
Mastercard managers are motivated to increase (1) the number of individuals who have and use a mastercard credit card, (2) the number of banks and other clents who issue mastercards to customers and/or employees, and (3) the number of locations that accept mastercard payments. discuss how mastercard could use its data warehouse to it expand each of these customer bases.
Answers: 3
image
Computers and Technology, 24.06.2019 15:30, pineapplefun
During the software planning process, rick, a project manager, finds that his team has made an incorrect estimation of funds. what kind of risk has rick identified? rick has identified a risk.
Answers: 1
image
Computers and Technology, 25.06.2019 08:20, perezsamantha3oqr0za
In the context of computer operations division is a(n)
Answers: 2
Do you know the correct answer?
Three functions are required:get_input():This function takes no parameters, but will ask the user fo...

Questions in other subjects:

Konu
Mathematics, 14.04.2020 22:38