Logo
1

Write a Python program to print the following pattern using nested loops (for a given n, where n is the number of rows):

(Expected output ↓)

a

aa

aaa

aaaa

davidmacagodavidmacago asked a year ago

·

Answers

1
def tree_builder(number):
    for count in range(number+1):
        print("a"*count)

tree_builder(4)

davidapdavidap edited a year ago

Post your answer

Recommended Books

Reading books is a great way to learn. Here are some of the books we recommend.