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
Jason wants to open a program with the command prompt window. Which command should he type in the Run dialog box to open the com
Montano1993 [528]
<span>1. Tap or click the Start button, followed by All apps.

If you're not using the Desktop in Windows 10, tap the All apps button on the bottom-left of your screen instead. It's the icon that looks like the small list of items.

Tip: The Power User Menu is a much faster way to get to Command Prompt in Windows 10 but only if you're using a keyboard or mouse. Just choose Command Prompt from the menu that appears after pressing WIN+X or right-clicking on the Start button. </span><span><span>Find the Windows System folder from the list of apps and tap or click it. </span><span>Under the Windows System folder, click or tap Command Prompt.

Command Prompt should open immediately. </span><span>You can now execute whatever commands in Windows 10 you'd like to run.</span></span>
4 0
3 years ago
How do operating system work?
SIZIF [17.4K]

Answer:

The "operating system" manages software and hardware on the computer. Uploads files, has great memory and processes management.

7 0
3 years ago
The waterfall model and spiral model are variations of SDLC. Do some research to find out what they are and explain how these mo
Radda [10]

Waterfall model and spiral model are used in software development life cycle or SDLC. Any software development process follows one of these models depending on the type of software and the requirements of the customer.

Waterfall model

This model is called as sequential model since it works in stages. The output of first stage becomes the input of the second stage.

The errors of the first stage can be rectified only when it is completed. This is time consuming and makes the process lengthy. Stage 1 is completed before stage 2 begins.

The six stages involved in waterfall model are Requirement Gathering and analysis, System Design, Implementation, Integration and Testing, Deployment of system, and Maintenance.

Spiral model

This model is implemented in iterations. It is also called evolutionary model.  

Initially a prototype of the system is prepared. Then, it is followed by development of small parts of the system.

These smaller parts are then assembled to produce the final system.

The four stages which form the spiral model are Identification, Design, Development and Evaluation and Risk Analysis.

The differences between the two models are summarized below.

1. Waterfall model works in linear method. Spiral model follows evolutionary method.

2. Errors and risks are discovered/ rectified after the stage is over. Errors and risks are discovered/ rectified earlier.

3. Waterfall model is suitable for small projects. Spiral model is suitable for large projects.

4. Requirements identification and planning is the initial stage in the waterfall model. Requirements identification and planning is done when needed, in the spiral model.

5. Waterfall model allows little to no flexibility in the system. Spiral model allows flexibility in the system.

6. Low flexibility makes the waterfall model more risky. High flexibility makes the spiral model less risky.

7. Waterfall model, overall, takes less time since requirements are clear. Spiral model is implemented when the requirements of the system are not clear and become clear through prototypes.

8 0
3 years ago
You have just provided the identification number that associates your new software purchase with the mobile device on which you
Lunna [17]
<span>software deployment, software decryption, app installation, product activation

Are those the answers to choose from?

</span>
5 0
3 years ago
How many people in the world
sveticcg [70]

Answer:

Around seven billion people

4 0
2 years ago
Other questions:
  • All languages from the second generation on must be translated into machine language for the computer to be able process the inp
    8·1 answer
  • Adam discovers a virus on his system that is using encryption to modify itself. the virus escapes detection by signature-based a
    14·1 answer
  • ABC software company is to develop software for effective counseling for allotment of engineering seats for students with high s
    13·1 answer
  • //Display message Module main () // Declare variables Declare real weight Declare real shipping //Get package weight Call getWei
    7·1 answer
  • Write a full class definition for a class named Counter, and containing the following members:________
    9·1 answer
  • Write a python program that requests a positive integer from the user, determines if it is a composite, a prime or neither prime
    8·1 answer
  • What are advantages of using document templates?
    13·2 answers
  • Write a program that takes paragraph from the user and prints all unique words in that paragraph using strings in c++
    5·1 answer
  • Is the most important characteristic of a hard drive.​
    7·2 answers
  • Facts and statistics collected together to be used for different purposes is
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!