I am trying to create a triangle of numbers using Python from user input. I have written a code but not sure how to do one thing in python. I would like to change the print(“Next row”) to the respective row accordingly. How do i do that?
Code:
numstr= raw_input("please enter the height:")
rows = int( )
def triangle(rows):
for rownum in range (rows)
PrintingList = list()
print("Next row")
for iteration in range (rownum):
newValue = raw_input("Please enter the next number:")
PrintingList.append(int(newValue))
print()
Is there any mistakes in my code? or is there any suggestions for improvements? please do tell me.. thanks…
I am not exactly sure what is desired behaviour for your program, but here is my guess:
And here is the output: