Question: use Python (1) In Lab 2, you made a program, using the turtle module, that could draw polygons of a user-specified number of sides. Create

use Python

use Python (1) In Lab 2, you made a program, using the

turtle module, that could draw polygons of a user-specified number of sides.Create a new program that draws the polygon, rotated a specified number

(1) In Lab 2, you made a program, using the turtle module, that could draw polygons of a user-specified number of sides. Create a new program that draws the polygon, rotated a specified number of times you may use your program from lab 2 in this exercise). Enter num sides : 8 Enter num sides of polygon: 20 Enter num polygons: 10 Enter num polygons: 20 Note the alternation of colours in the drawing (you may choose any colours, just that the alternation of colours should kept). Make sure your figure stays within the window for any number of sides and and number of polygons. (2) Create a program trianglePursuit.py. For this, set up three turtles at the corners of an equilateral triangle, of side 400 units. In this program, turtle 1 chases turtle 2. Turtle 2 chases turtle 3 and turtle 3 chases turtle 1. Each turtle should trace its path (use a different color for each turtle's path) as above. Stop the program when the turtles meet. You may need to specify a distance (rather than an exact location) to stop the turtles, as having multiple turtles stop in the exact location using floating point numbers is rare. 1 2 (3) In the book Liber Abaci, Leonardo of Pisa (better known as Fibonacci) considers pairs of breeding rabbits in an enclosure. At the start of month zero there is a single infant pair of rabbits. A pair of rabbits matures in 2 months. Rabbits do not breed in their first month of life. Each mature pair of rabbits produces an infant pair of rabbits on the last day of each month, starting with the second month. Rabbits are not mortal. Leonardo asks: How many pairs will there be one year after this pair begins breed- ing. For more information about Fibonacci's problem see: https://tinyurl.com/y5sadcpb Let F[j] denote the number of pairs in month j. A slight modification of the above problem gives: F[0] = 0, F[1] = 1, and F[j] = F[j 1] + F[j 2], n> 2 (a) Write program FibonacciSeq.py that prompts the user for a positive integer n and then computes and prints out the Fibonacci sequence up to F[n]. You program should print the sequence with 5 Fibonacci numbers per line (except in the last line). The Fibonacci numbers for the range above are at most 4 digits. Use print('{:5d}'.format(F[j]), end="") to print values with widths of 5 digits. This will give a reasonable display (we will examine formatted output in the next lab). What is the answer to Leonardo's question? You will need to refer to: https://docs.python.org/3/tutorial/datastructures.html for list meth- ods. (b) Make your program print compute the ratio: F[j +1] for 2 2 (a) Write program FibonacciSeq.py that prompts the user for a positive integer n and then computes and prints out the Fibonacci sequence up to F[n]. You program should print the sequence with 5 Fibonacci numbers per line (except in the last line). The Fibonacci numbers for the range above are at most 4 digits. Use print('{:5d}'.format(F[j]), end="") to print values with widths of 5 digits. This will give a reasonable display (we will examine formatted output in the next lab). What is the answer to Leonardo's question? You will need to refer to: https://docs.python.org/3/tutorial/datastructures.html for list meth- ods. (b) Make your program print compute the ratio: F[j +1] for 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!