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
Need help please help me <br>I need it right now ​
Vika [28.1K]

Answer:

1. G

2. J

3. I

4. B

5. A

6. H

7. C

8. F

9. E

10. D

11. D

12. C

13. A

14. B

Explanation:

1. OCR: converts paper based text to digital form. OCR is an acronym for Optical Character Recognition.

2. OMR: marks candidates' responses on a multiple choice exam. OMR is an acronym for Optical Mark Recognition.

3. Printer: produces a hard copy document. It is an output device that accepts electronic data and prints them on a paper (hardware document).

4. Joystick: used for playing a car racing game on the computer

5. Sensor: turns on the light when someone enters the room. It can be defined as a device designed to detect changes or events within its immediate surroundings and then transfers this data to the central processing unit of a computer.

6. ROM: Contains 'boot up' instructions. ROM is acronym for read only memory and it contains the basic input and output system (BIOS) used during a computer start-up.

7. Pad and tablet: draws lines in an architectural design. They are an electronic device that can be used two or three dimensional shapes.

8. Modem: Modulates and demodulates signals. Modulation refers to the conversion of digital signals into an analogue signal while transmitting it over a line. Demodulation is the conversion of analogue signal into a digital signal.

9. Barcode reader: Reads data containing information on a product

10. MICR: reads digit specially printed on a cheque. MICR is an acronym for Magnetic Ink Character Recognition.

Section B

11. Banking industry: managing user accounts through the use of software applications.

12. Weather forecasting: predicting the weather through the use of software programs.

13. Household appliance: sequencing wash cycle tasks in a washing machine.

14. Manufacturing industry: using robots to assemble a car components.

8 0
3 years ago
What would happen if computers only had input peripherals and a CPU
Wewaii [24]
It will overheat because it don't have gpu
8 0
3 years ago
Read 2 more answers
I am a receptionist for a large corporation
Musya8 [376]
Therefore the answer is within yourself
5 0
4 years ago
In Python please.
Lubov Fominskaja [6]

Answer:

Explanation:

We have the following

t is the number of test cases.

n is the number of trips for each testcase

name is the name of the city

all the unique names are added to the list and at last the length of the list is printed.

The program is written as follows

t = int(input) - for i in range(t): n = int(input) 1 = [] for j in range(n): name = input if name not in l: 1.append(name) pr

t = int(input())

for i in range(t):

n = int(input())

l = []

for j in range(n):

name = input()

if name not in l:

l.append(name)

 

print(len(l))

Output:

8 0
4 years ago
Document could not be saved bad file handle
creativ13 [48]
To help fix this problem try reviewing the file and opening it on your own when your sure its good on your side then try to save it if all else fails make a new one
8 0
4 years ago
Other questions:
  • in your own experience,imagine if someone gained access to any of your social media accounts they could changed your account nam
    11·1 answer
  • In reference to computer communications, what does the term noise mean?
    8·2 answers
  • Varied amount of input data Statistics are often calculated with varying amounts of input data. Write a program that takes any n
    8·1 answer
  • You're a short-order cook in a pancake restaurant, so you need to cook pancakes as fast as possible. You have one pan that can f
    14·1 answer
  • Logo Game:name the 10 social media logos you see in the picture below​
    15·2 answers
  • Write function that ask for input from a user. Use this input as input for the countdown function that we wrote using the while
    6·1 answer
  • Group of answer choices When declaring a variable, you also specify the type of its values. Variables cannot be assigned and dec
    7·1 answer
  • Follow me on insta Aaftabkhan_7​
    13·2 answers
  • Who was the first person to develop http the language in which servers and browsers communicate
    11·1 answer
  • _____ have networked and texted all of their lives with smartphones, tablets, and high-speed Internet.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!