Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in python please QUESTION 11 Write a Python function called print_grid( n_rows, n_cols) that takes how many rows ( n_rows ) and how many columns

in python please

image text in transcribed image text in transcribed

QUESTION 11 Write a Python function called print_grid( n_rows, n_cols) that takes how many rows ( n_rows ) and how many columns ( n_cols ) it should print a pair of empty square brackets, [], in grid form. Examples: >>> print_grid( 5, 3) 0001 000 000 000 2010 >>> print_grid( 4, 7) [10001000 [10] [] [] [] O QUESTION 12 The Fibonacci numbers are defined by the sequence fi = 1 f2 = 1 Sn = |n-1 + fn-2 That is, the next Fibonacci number, fn, is the addition of the previous two values, fn-1 and fn-2. Note that the first two values, fi and f2, in this sequence are both 1. So the third value in this sequence is 2 (1+1). Adding the second (1) and third values (2), we get the fourth value, which is 3. Then the fifth value will be 5 (2 + 3), and so on. Write a Python function called fibonaccin) that returns a list of Fibonacci values up to and including the n'h Fibonacci number. Examples: >>> fibonacci( 7 ) (1, 1, 2, 3, 5, 8, 13] >>> fibonacci( 10 ) [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] QUESTION 13 Taking advantage of the implementation of draw_polylinel) and the approach in draw_regular_polygon(), write a Python function def draw_star( n, outer_r, inner_r, center, canvas, start_angle=0 ) where n is the number of points, outer_r and inner_r are the radia for the coincentric circles around the center point of the star that determines how the tips are to be drawn. The canvas is the canvas object obtained from the ezgraphics module. The start_angle determines how much the shape should be rotated with respect to the horiztonal. You can see a guided drawing that demonstrates how you should be computing the vertices of the star with 5 ( n-5 ) tips. In the figure below where n=5, the outer radius would be the radius of the blue circle, and the inner radius would be the radius of the green circle. QUESTION 14 Solve PROGRAMMING EXERCISE .. P4.5 You should assume that when the user presses (Enter) without entering a number that there's no more input to be processed. Consider the following example code snippet. L]: while True: V_str = input ( "Enter value: ") print("--- Entered: [{}]".format( v_str ) ) if v_str and not v_str. isspace(): # v_val = float( v_str) print("--- Read: {}".format( v_val) ) else: print( "" ) break Enter value: 3 Entered: [3] --- Read: 3.0 Enter value: 4 Entered: [4] Read: 4.0 Enter value: 5 --- Entered: [5] --- Read: 5.0 Enter value: --- Entered: U

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

Describe the components of a job description.

Answered: 1 week ago