subject
Computers and Technology, 07.06.2021 01:00 pmdm95

Import Math Def Isprime X N 2 N 3 Return True N 2 N 2 0 Return False N 9 Return True N 3 0 Q36682051 . . . import mathdef is_prime(x):if n == 2 or n == 3:return Trueif n < 2 or n % 2 == 0:return Falseif n < 9:return Trueif n % 3 == 0:return Falser = int(n**0.5)f = 5while f <= r:print ('t',f)if n % f == 0:return Falseif n % (f + 2) == 0:return Falsef +=6return True n = int(input('Enter an integer:n'))print (is_prime(n))
I got a few questions about this code. What's the use for theline of code that says if n < 9 return True?
Lastly, I'm not sure what's going on in this part of the code. The part where n has a power of 0.5 and f = 5 are more confusing. If anyone could help, I'd appreciate it. Thank you!
r = int(n**0.5)f = 5while f <= r:print ('t',f)if n % f == 0:return Falseif n % (f + 2) == 0:return Falsef +=6return True

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:10
If you want to import a picture into a dtp application, what must you do first? draw an image frame. import text. open the folder containing the file. select get image… from the windows menu.
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
question
Computers and Technology, 23.06.2019 22:30
Janice usually works on a particular workbook that contains all business related data. she decides to keep a backup of all the data in a separate workbook. she opens a new workbook to transfer the data. which option should she use to copy all the data from one workbook to another workbook?
Answers: 1
question
Computers and Technology, 25.06.2019 01:30
The physical parts or components of a computer system is called .
Answers: 1
You know the right answer?
Import Math Def Isprime X N 2 N 3 Return True N 2 N 2 0 Return False N 9 Return True N 3 0 Q36682051...
Questions
question
Mathematics, 05.05.2020 02:09
question
Mathematics, 05.05.2020 02:09
question
Mathematics, 05.05.2020 02:09
question
Mathematics, 05.05.2020 02:09
question
Mathematics, 05.05.2020 02:09
question
Mathematics, 05.05.2020 02:09
Questions on the website: 13722361