Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Page 2 Part 2: Due in Gradescope by the start of your lab time next week You will create and submit a single script including

image text in transcribed
image text in transcribed
image text in transcribed
Page 2 Part 2: Due in Gradescope by the start of your lab time next week You will create and submit a single script including each of the following function definitions (see the assignment page in Canvis for a starter script). Remember to pay close attention to whether your result should be returned or print ed. No string operations may be used on this Inb. You should print enough ist es below each of your function definition to be reasonably sure it works for all types of inputs as described in the problem. Your test cases should be different from any of the examples provided in the problem. 1. Usenested for-loops to write a function print_shapes that takes a positive integer and prints a triangular grid of numbers, as shown below. The target outputs for nd and 5 are: print_shape3(4) print_shape3 (5) 1 12 1 2 3 1 2 3 4 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 2. Une tested for-loops to write a function print_shaped that takes a positive lead prints a triangular of asterisks within Towns shown below. The 1 = 5 2 hop os 40 & 6 7 00 print_shape4(4) print_shape4(5) Hint: It may be helpful in this problem to construct schows two sequential for-loops, one that creates some member of blank spices, then another that creates sone number of asterisk. 3. Use nested for-loops to write a function print_shape5 thunt takes a positive inter and prints a triangular array of muebers, as shown below. The target ontputs for and ne: print_shape5(5) print_nhape5 (4) 4 43 4 3 2 4 3 2 1 5 54 5 4 3 5 4 3 2 5 4 3 2 1 Dit hp 11 prese 40 t bocks 5 & 7 6 8 9 O T T U Y 1 O [ Page 3 of 3. Use nested for-loops to write a function print_shape that takes a positive integer and prints a triangular array of numbers, as shown below. The target outputs for * = 4 and = 5 are print_shape() print shape5(5) 5 4 4 3 4 3 2 4 3 2 1 548 5 4 3 2 5.4 3 2 1 4. Use nested for-loops to write a function print_shapes that takes a positive integrand prints a triangular way of numbers, as shown below. The target outputs for fan = 5 Art: print shape (4) print shape 6(5) 1 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1 papers op 5 6 & 7 00. 9

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 Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions