Python pattern from from incresing and descresing sequnce of numbers
This post will explain the logic, code and Syntax for pattern program in Python Programming. In this post you will understand how to right the code of a pattern which have the sequence in descreasing and incresinng sequence.
Pattern Code-
def python_pattern(n):for i in range(0, n):if n/2 >= i:
for j in range(1, i+1):print(j, end=" ")print("\r")
else:
for j in range(1, n - i + 1):print(j, end=" ")print("\r")n=10python_pattern(n)
No comments:
Post a Comment