Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def draw_x (height): ------------------------------------------------------- Prints a X shape height characters high. Use: draw_x(height) ------------------------------------------------------- Parameters: height - maximum height in characters of X shape

def draw_x(height):

"""

-------------------------------------------------------

Prints a X shape height characters high.

Use: draw_x(height)

-------------------------------------------------------

Parameters:

height - maximum height in characters of X shape (int >= 3)

Returns:

None

-------------------------------------------------------

"""

# Your code here

return

Complete the function draw_x in the t04_functions.py module. The module t04.py provides simple testing for this function.

Given a positive integer parameter, this function prints an X using the # character where the height of the X is height characters. The widest width of the X is equal to the height. Some examples from executing t04.py:

draw_x(5) -> # # # # # # # # # draw_x(6) -> # # # # ## ## # # # # draw_x(7) -> # # # # # # # # # # # # #

Requirements

This function must:

  • use for loops
  • Hint: lines must not end with spaces

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions