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
It is manadatory to include a banner marking at the top of the page to alert the user that cui is present.
ololo11 [35]
A. True is the right answer
6 0
2 years ago
Read 2 more answers
Which statistical function in a spreadsheet helps you to see how far each number varies, on average, from the average value of t
SpyIntel [72]

RANK.AVG function

This function in Excel helps return the statistical rank of a specific value within a list of numbers. The statistical rank is calculated by arranging the number usually, in a descending way and then assigning a position to each value in a list.

8 0
2 years ago
Tom and his brother caught 100 finish on a weeklong fishing trip. The total way of the fish was 235 pounds. What is the weight o
valina [46]

This is math but here is the answer. All you have to to to find this problem is divide 235 by 100 which is 2.35. The total weight of one fish is 2.35 pounds.

5 0
3 years ago
Which statement is false? Select one: a. Function printf does not care how large the array it is printing is. b. Function scanf
dusya [7]

Answer:

Option A

Explanation:

Because each function has specific amount of space allocated by default on the stack, so it cares about the length of the array being printed by it. By default the space is up to 100 kb but this size can be increased by setting it manually.

Option B is correct answer because scanf takes input from user until first space is hit.

6 0
3 years ago
A game’s ______ is what contains its directions and calculations; some refer to it as the “engine” that drives the game.
Jobisdone [24]
Possibly the programming language.
4 0
3 years ago
Other questions:
  • In the windows firewall, any rules preceded by a __________ checkmark have not been enabled. black gray green red
    13·1 answer
  • You are asked to optimize a cache design for the given references. Th ere are three direct-mapped cache designs possible, all wi
    7·1 answer
  • What education and training is required to be an applications software engineer?
    9·1 answer
  • Which logic correctly describes an algorithm to find the smallest of the three numbers a, b, and c and store the smallest number
    15·1 answer
  • PLEASE HURRY 30 POINTS
    15·2 answers
  • .<br>1.<br>CPU<br>f. ALU<br>. CU<br>h. CRT<br>g. LED<br>​
    15·1 answer
  • Juan has performed a search on his inbox and would like to ensure the results only include those items with attachments which co
    14·2 answers
  • What is one of four key principles of Responsible AIntelligence (AI) vendor serviceIntelligence (AI) vendor serviceI
    7·1 answer
  • PLZZZZZZZZZZZZZZZ HELP ME OUT!!!!! I SICK AND TIRED OF PEOPLE SKIPING MYQUESTION WHICH IS DUE TODAY!!!!
    14·1 answer
  • Most of the energy we use originally came from:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!