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
Complete the concept map on computer as outlined below​
USPshnik [31]

Answer:

Here is your answer.

have a great day

6 0
2 years ago
Create a Produceclass that hasan instance variable of type Stringfor the name, appropriate constructors, appropriate accessor an
Nezavi [6.7K]

Answer:

you suck

Explanation:

5 0
3 years ago
Who were 4 major people that attended the constitutional convention
postnew [5]
Alexander Hamilton, George Washington, James Madison, and Benjamin Franklin
7 0
3 years ago
Which of the following tags contains metadata about the webpage?
Andre45 [30]
I cannot see the options but I am guessing that it is just regular HTML

If that is the case the <meta></meta> tag can be used and should be placed within the <head></head> tag
8 0
3 years ago
Read 2 more answers
What are the differences between packet and circuit switching? Which is more prevalent today?
Juliette [100K]

Answer: The difference present between the packet switching and circuit switching are as follows:-

  • Packet switching i the switching in which the data packet travels through the connectionless path whereas connection oriented routes are present for circuit switching
  • Network layer uses the feature of packet switching while physical layer uses circuit switching technique
  • Data transferring is mostly preferred through packet switching and voice communication takes place through the circuit switching.
  • Packet switching is considered flexible as no already established connection is present for switching but the connection in circuit switching are already defined which makes it less flexible.

Among the packet switching and circuit switching , packet switching is preferred for the communication through the data packets because they have  flexibility and affordability.It can establish numerous connection for switching and this make it efficient.

4 0
3 years ago
Other questions:
  • 2- There are many different design parameters that are important to a cache’s overall performance. Below are listed parameters f
    11·1 answer
  • Give two examples of desktop publishing software
    7·1 answer
  • What is a negative impact of digital communication
    6·1 answer
  • What is &lt;html&gt;
    9·2 answers
  • An item such as a smart card is an example of the _______ form of authentication.
    10·1 answer
  • You have developed a prototype of a software system and your manager is very impressed by it. She proposes that it should be put
    5·1 answer
  • Write a program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere’s: Diameter (2
    7·1 answer
  • Why are ethics important in PR?
    8·1 answer
  • WIRELESS DATA TRANSMISSION METHODS​
    8·1 answer
  • What is python, the coding language
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!