Consider the code snippet named shapespy a statement to


Below are 2 out of the 20 questions that I am struggling with. Any assistance would be appreciated.

1) Consider the code snippet named shapes.py. A statement to call the draw_square function from the shapes module, passing an argument of 3 would be _______________.

cr = '#'

import shapes

def draw_square(size):

for h in range(size):

for w in range(size):

print(cr, end='')

print()

def draw_rect(height, width):

for h in range(height):

for w in range(width):

print(cr, end='')

print()

a) draw_rect(3)

b) draw_square(3.0)

c) shapes.draw_square(3)

d) The program throws an error

2) The following code uses functions defined in my_funcs.py. Complete the import statement at the top of the program.

____________________

a = 3

print('a! = ', factorial(a))

print('log(a) = ',log(a))

a) import factorial, squared

b) import factorial, log

c) from my_funcs import factorial, log

d) from my_func import factorial log

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Consider the code snippet named shapespy a statement to
Reference No:- TGS02724412

Now Priced at $10 (50% Discount)

Recommended (90%)

Rated (4.3/5)