pattern question - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: pattern question (/thread-28578.html) |
pattern question - spalisetty06 - Jul-24-2020 ''' 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 ''' '''I am trying to print the pattern''' n = int(input("Please enter the number of times ")) for i in range(n): for j in range(n, 0 -1): print(j, end = " ") print() I am not looking for solution but please tell me why is that, it is not printing the output. In regards to solution, I am still working on it.I made a big time small mistake, Thank you RE: pattern question - DeaD_EyE - Jul-24-2020 for j in range(n, 0 -1):A comma is missing: for j in range(n, 0, -1): range accepts one, two or three arguments.This code: range(n, 0 -1) Is evaluated to: range(n, -1)
|