Question: Follow the requested format for the file name, program inputs, and program outputs. The output should match the input. Programming language:Python Question 4: Pyramid of

Follow the requested format for the file name, program inputs, and program outputs.

The output should match the input.

Programming language:Python

Question 4: Pyramid of Numbers [100 marks]

Why have civilizations in many parts of the world been built as pyramids? What makes pyramids so special? Do you know it is estimated that the Great Pyramid of Giza is built of 2.3 million stone blocks? There is a lot to know about pyramids and this assignment wants to motivate you to do so by writing a program, called PyNum, which draw a pyramid of numbers.

PyNum first ask the user about the pyramids height using the message 'What is the height of the pyramid? '. Lets call the pyramid height h, which should be a positive integer. Next, PyNum prints a pyramid of height h with numbers as following:

PyNum only prints a pyramid of numbers taller than 1 and shorter than 10. In other words, the user-provided input can not be smaller than 2 or greater than 9.

If the user-provided value is not in the specified range, PyNum will let the user know using the message 'PyNum cannot help you!'

On the top of the pyramid and in the first line, PyNum will always print 1, as depicted in Figure 4.

PyNume will print '1 2 3 ...n n-1 n-2 ...1' in the nth line of pyramid. Lets assume h = 3, then, the first line of the pyramid will be 1. And second and third lines will be '1 2 1' and '1 2 3 2 1', respectively.

Note that there is a white space between each pair of consequent numbers. Figure 4 shows a sample output of PyNum for h = 9.

https://www.icloud.com/photos/#040NUMgrtdf-RQ8pJEjLnmeHw

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!