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]
4 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:
Andreyy894 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
#Write a function called hide_and_seek. The function should #have no parameters and return no value; instead, when #called, it s
Arlecino [84]

Answer:

# hide_and_seek function is defined

def hide_and_seek():

# for loop from 1 to 10

# and print each number

for number in range(1, 11):

print(number)

# the last message is displayed on its own line

print("Ready or not, here I come!")

# the function is called

hide_and_seek()

Explanation:

The code is well commented. A sample image of the output when the code is executed is attached.

7 0
3 years ago
According+to+gartner+research,+by+2020,+_____+will+be+the+greatest+source+of+competitive+advantage+for+30%+of+organizations.
pentagon [3]

According to Gartner Research, by 2020, digital dexterity will be the greatest source of competitive advantage for 30% of organizations.

Organizations are under increasing pressure to keep up with the ever-changing digital landscape. To stay ahead of the competition, many are turning to digital dexterity as a source of competitive advantage.

Gartner Research predicts that by 2020, digital dexterity will be the greatest source of competitive advantage for 30% of organizations. To achieve digital dexterity, organizations need to be able to rapidly adapt to changing market conditions and technologies.

To stay ahead of the competition, organizations need to invest in training and development programs that will help employees stay up-to-date with the latest digital trends. Additionally, organizations need to create a culture of innovation that encourages employees to experiment with new technologies and ideas.

By 2020, digital dexterity will be a critical source of competitive advantage. Organizations that are able to effectively harness the power of digital technology will be well-positioned to succeed in the future.

Learn more here:

brainly.com/question/17178886

#SPJ4

7 0
2 years ago
It is the "executable" phrase of Word<br>Wide Web with dynamic applications,?<br>​
Mkey [24]

Answer:

It is the “executable” phrase of Word Wide Web with dynamic applications, interactive services, and “machine-to-machine” interaction. In Web 3.0, computers can interpret information like humans and intelligently generate and distribute useful content tailored to the needs of users.

4 0
3 years ago
Is a Mazda RX7 rotary?​
bagirrra123 [75]

Answer:

Mazda RX-7. The Mazda RX-7 is a front-engine, rear-wheel-drive rotary engine powered sports car manufactured and marketed by Mazda from 1978–2002 across three generations—all noted for using a compact, lightweight Wankel rotary engine.

4 0
4 years ago
What is computer ????
LekaFEV [45]

Answer:

Explanation:

A computer is a device that manipulates information, or data accrding to the instructions given to it and give us an output. It has the ability to store, retrieve, and process data.

6 0
4 years ago
Other questions:
  • Chunking is a good strategy for completing large assignments because it makes the work
    15·1 answer
  • Can somebody help me?
    11·1 answer
  • Define an organizational unit in your own words.
    11·1 answer
  • Andrew works for a company that develops for a company that develops optic-fiber cables for transmission of data. which layer of
    14·1 answer
  • The paint 3D program is used for drawing picture true or false​
    10·2 answers
  • How many sets of number do both Hex and RGB values have?
    10·1 answer
  • Write, in your own words, a one-two paragraph summary on the Running Queries and Reports tutorials. Apply critical thinking and
    10·1 answer
  • Explain two ways that you can create a header.
    14·1 answer
  • after confirming the removal of a virus from a computer, how should the technician ensure and verify the full functionality of t
    7·1 answer
  • You have created a slide that is functional, but a bit on the boring side. In five to ten sentences, describe changes you would
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!