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
nadya68 [22]
3 years ago
10

Write a function (named n_pointed_star) to make the turtle draw an n-pointed star. The function should return nothing, and accep

t a single parameter (n_points) which specifies the number of points to draw.
Computers and Technology
1 answer:
Andreyy893 years ago
8 0

Answer:

import sys

import turtle

import random

def n_pointed_star(total_points):

if total_points <= 4:

 raise ValueError('Not enough total_points')

area = 150

for coprime in range(total_points//2, 1, -1):

 if greatest_common_divisor(total_points, coprime) == 1:

  start = turtle.position()

  for _ in range(total_points):

   turtle.forward(area)

   turtle.left(360.0 / total_points * coprime)

  turtle.setposition(start)

  return

def greatest_common_divisor(a, b):

while b != 0:

 a, b = b, a % b

return a

   

turtle.reset()

n_pointed_star(5)

Explanation:

  • Inside the n_pointed_star function, check whether the total no. of points are less than or equal to 4 and then throw an exception.
  • Loop through the total_points variable and check whether the result  from greatest_common_divisor is equal to 1 or not and then set the starting position of turtle and move it.
  • Create the greatest_common_divisor which takes two parameters a and b to find the GCD.
  • Finally reset the turtle and call the n_pointed_star function.
You might be interested in
Betty set up an account on a popular social networking website. She wants to know whether the privacy policy is effective for he
Ahat [919]

the info needed to log in

-This would show what is protected in the privacy policy and its related to you since it would show personal data.

-A good Privacy Policy depends on understanding these matters - showing that this is not an agreement to take for granted.

7 0
3 years ago
Jorge is sending a large image file to a friend as part of a shared classroom project. Which of the following is most likely tru
madreJ [45]

Answer:

D. The image will require fewer bits in order to be represented.

Explanation:

Lossy compression algorithms are typically better than lossless compression algorithms at reducing the number of bits needed to represent a piece of data.

5 0
3 years ago
Sam needs to create a spreadsheet for his coworkers. They will need to follow across a long row of data. Sam would like to make
castortr0y [4]
The answer youre looking for is A.
3 0
3 years ago
Read 2 more answers
What's the keyboard command that will allow you to "copy" text?
lana66690 [7]

For mac/apple operating systems; command c to copy command v to paste

For windows operating systems; control c to copy control v to paste

4 0
3 years ago
Read 2 more answers
Which two programming languages require the program to be converted into executable code using a compiler? (Choose two.)
forsale [732]

Answer:

C# and Java

Explanation:

Compiler can be regarded as a program that helps in transforming a source code( source program) to another program knowns as machine code. Some of the programming languages that needs a compiler are C# and Java. The compiler will collect the the set of instructions of the new program that was written using high level language and translate it into machine language.

8 0
3 years ago
Other questions:
  • g The reciprocal Fibonacci constant ψ is defined by the infinite sum: ψ=∑n=1 [infinity] 1 Fn Where Fn are the Fibonacci numbers
    7·1 answer
  • Add the following functions to the code:
    9·1 answer
  • ISBN-13 is a new standard for identifying books. It uses 13 digits d1d2d3d4d5d6d7d8d9d10d11d12d13. The last digit d13 is a check
    9·1 answer
  • What is search engine
    15·2 answers
  • A tornado may be approaching if you observe which of the following?
    15·1 answer
  • Which of the following is not a location where text can be entered​
    15·1 answer
  • Type the correct answer in the box. Spell all words correctly. How is it possible to access data from any location? Storing data
    12·1 answer
  • What can the tab key do
    10·1 answer
  • Search the Web for three different employee hiring and termination policies. Review each and look carefully for inconsistencies.
    5·1 answer
  • What is the difference between algorithm and flowchart​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!