Question: Write a program in python and pseudocode You can assume the user will enter a positive integer. You do not need to check for this

Write a program in python and pseudocode
You can assume the user will enter a positive integer. You do not need to check for this (that's call defensive programming, which we will cover in
chapter 7). You can also assume the user will not enter zero (although in math the triangular number of zero is zero).
You may not use any feature in Python that we did not learn in class. This includes, but is not limited to, any mathematical functions or string
functions.
You may use the asterisk operator in your Python code to repeat strings. See Demo_04_15.py Q for an example.
In Pseudocode you may use the repeat () function to repeat a string. Note this is not described in the textbook. See Demo_04_15.gad theta for an
example.
Your program will calculate a single triangular and then end. It should not prompt the user for a second number.
I suggest starting with an "intermediate" version that does not print the X's. Instead print the numeric term on each line. This version only requires a single loop. Once you have this working you can go back to add the second (inner) loop to print the X's. There is a screenshot of this version below.
If you get stuck on this intermediate version, decide what needs to be done once and what will be done multiple times. Decide what needs to go inside of the loop, what goes before the loop, and what goes after.
For example, if the user enters 4:
How many times is T(4)= displayed?On how many lines are the terms (or Xs) displayed?How many times is =10 displayed?
Be sure to use the integer data type for this assignment. The floating-point data type does not make sense.
Do not use the same variable name for two different things, even if you program still works. That is a general rule that applies to all your assignments, but there is a reason I am mentioning it here. It's easy to do with nested loops.
You can do more than one thing inside the body of a single loop. For example, in Demo_04_06.py we saw a loop that printed numbers inside the loop, but also calculated a running total.
All of your assignments must follow the coding standards we discussed in class.
Be sure to turn in your assignment via the Blackboard site by the due date/time (see below) for full credit.
What to Turn In
For this assignment you need to turn in:
The pseudocode program file named Project_01.gad
The Python program file named Project_01.py
Enter a positive integer:
5
T(5)=
XXXXX
XXXX
XXX
XX
X
=15
** James Shoe **
Enter a positive integer:
2
T(2)=
XX
X
=3
Note: This is an intermediate version!
Enter a positive integer:
5
T(5)=
5
4
3
2
1
=15
Write a program in python and pseudocode You can

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 Programming Questions!