Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 1 - Design Number Pyramid When doing a System Dexigh for functions, you should doign a function yepuraty from the design of the main

Task 1- Design Number Pyramid
When doing a System Dexigh for functions, you should doign a function yepuraty from the design of the main part of the progran. After a
function is desiend, it can singly be called in another part of the design. Wou will wrile a program burd on a ghen Spiten Desien. Note that
You will not creabe a full System Devign for this task. Your progam will be coeabed in a Hile called uact py. You will oreate a file called
Requirements
The use wil enter the number of rows to have in a pyramid of numbers. flowed on the coers input the progam will doplay a pyramid where
the bottom row.
the bottom row.
Enter the number of rows: 15
Enter the number of rows: 9
Notes
On the bottom row there shouldn't be any space before the first number or after the last.
Your centering doesn't have to be exactly the same as the picture above. Notice how the first digit of the first 14 is above the 5, but the
second digit of the last 14 is above a space. Your implementation may result in the 14 th row (and similar rows) being shifted by 1 space as
compared to the picture.
Remember that you can multiply a string by an integer, to repeat that string multiple times! e.8. "Hello" 3. "HelloHelloHello"
If the number of rows goes past 10 there is a ledge in the pyramid. You don't need to space the single digit numbers to span the width.
Just one space between each number.
The len0 function will probably come in handy. If the parameter is a string. it will return the number of characters in the string. What can
you do if you want to know how many digits are in a number if len0 needs a string? You do not have to use this to successfully complete
Just one space between each number.
The len() function will probably come in handy. If the parameter is a string, it will return the number of characters in the string. What can
you do if you want to know how many digits are in a number if len() needs a string? You do not have to use this to successfully complete
this task though.
Note how in the System Design each function is defined separately, and one function design can call another function
Starter Design
Below is the system design file to build your implementation. Once built, you'll notice an error in the design. Create a file called design 1f.txt to
describe the error and how you fixed it. You can just describe your process in a paragraph. Your code should be in a file called
task1.py.
Systen Design
make_number_gyranid function
Create formal parameter for the number of rows from the caller of the function
Create a string varlable that will be returned. Start as an eapty string.
Create a loop froa to the number of rows (including the number of rows value)
a. Create a string variable for the row of text
b. Create a loop from 0 to the current row number
Create a conditional to concatenate a space to the text if it's not the first character of the rome
c. Add the roa of text string to the atssage variable. Make sure to add a nemline at the end
Return the string nessage
main function
Get inqut fron the user for the number of rows to print.
Call makelimberPyranid using the value from the user and save the return
Print the return value
progran start - Note: You do not need to include this in your future designs as this is implied.
image text in transcribed

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

Students also viewed these Databases questions