4. Write the code in python to generate the following pattern [4]
a) 1 b) *****
12 ****
123. ***
1234 **
*
Answers
Answered by
2
Answer:
# 1-12-123-1234 Pattern up to n lines
n = int(input("Enter number of rows: "))
for i in range(1,n+1):
for j in range(1, i+1):
print(j, end="")
print()
Answered by
0
Answer:
rows = 5
for i in range(0, rows):
print("*", end=' ')
print("\r")
rows = 4
for i in range(0, rows):
for j in range(0, i + 1):
print("*","12", end=' ')
print("\r")
Similar questions