Question: hello below is my code in python I have to make a right triangle based on input and I'm getting this error (attached pic) trianglesize
hello below is my code in python I have to make a right triangle based on input and I'm getting this error (attached pic)
trianglesize = int(input("Enter triangle size: "))#input trianglesize counter = 0 if trianglesize 0. Exiting... " )#printing and exit.
for row in range(1, trianglesize + 1): for j in range(1, row + 1):#loop till trianglesize+1 from 1 if row == 1 or row == trianglesize or j == 1 or j == row:#condition
if(j == trianglesize or j == row): # while (counter==1): print('*', end = '') else: print('*', end = ' ') else: if(j == trianglesize or j == row): print(' ', end = '') else: print(' ', end = ' ') print()#to start newline
please try to keep the code as it is just probably add something to meet the criteria

1. One A Output is nearly correct; but whitespace differs. See highlights below. Special character legend Input 1 Your output Enter triangle size: Enter triangle size: * Expected output Special characters Newline: Created with an expression for inserting a new line such as in, endi(C++), and printin(Java) Space: An unexpected space was detected in the output. Tab: Created with an expression for inserting a tab, such 7 as \t Replacement System is unable to render this character. Done |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
