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 thats call defensive programming, which we will cover in
chapter 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 Demopy 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 Demogad 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 Xs 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 Xs 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 :
How many times is T displayed?On how many lines are the terms or Xs displayed?How many times is displayed?
Be sure to use the integer data type for this assignment. The floatingpoint 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 Demopy 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 datetime see below for full credit.
What to Turn In
For this assignment you need to turn in:
The pseudocode program file named Projectgad
The Python program file named Projectpy
Enter a positive integer:
T
XXXXX
XXXX
XXX
XX
X
James Shoe
Enter a positive integer:
T
XX
X
Note: This is an intermediate version!
Enter a positive integer:
T
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
