Write a program named stars.py that has two functions for generating star polygons. One function should be implemented using an iteration (a for lo another function should be a recursion. It is optional to fill in your shapes. The functions for generating stars should be named star (size, n, d=2) and star_recursive (size, n, level, d=2), where size is the size of the polygon side (edge), n is the number of sides (or angles), d is a density or winding number that should be set to default value 2, and level is the level of recursion ini equal to n. You can read about star polygons here: Star polygon - Wikipedia. You can test your code with the following driver code. NOTE: In your functions, you need to use a variable t that refers to the turtle object instantiate main program # main program if __name__ ==== '__main__': s turtle. Screen() s.setup(800, 400) s.bgcolor("white") s.title("Turtle Program") t = turtle. Turtle() t.shape("turtle") t.pen(pencolor='dark violet', fillcolor='dark violet', pensize=3, speed=1) t.penup() t.goto(-150, 0) star(100, 5, 2) # should draw a purple pentagram (5-pointed star) t.penup() t.goto(150, 0) t.color('red') t.pendown() (100 inted ston)
Write a program named stars.py that has two functions for generating star polygons. One function should be implemented using an iteration (a for lo another function should be a recursion. It is optional to fill in your shapes. The functions for generating stars should be named star (size, n, d=2) and star_recursive (size, n, level, d=2), where size is the size of the polygon side (edge), n is the number of sides (or angles), d is a density or winding number that should be set to default value 2, and level is the level of recursion ini equal to n. You can read about star polygons here: Star polygon - Wikipedia. You can test your code with the following driver code. NOTE: In your functions, you need to use a variable t that refers to the turtle object instantiate main program # main program if __name__ ==== '__main__': s turtle. Screen() s.setup(800, 400) s.bgcolor("white") s.title("Turtle Program") t = turtle. Turtle() t.shape("turtle") t.pen(pencolor='dark violet', fillcolor='dark violet', pensize=3, speed=1) t.penup() t.goto(-150, 0) star(100, 5, 2) # should draw a purple pentagram (5-pointed star) t.penup() t.goto(150, 0) t.color('red') t.pendown() (100 inted ston)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
help in pytyhon
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY