John Deere Interview Question

Python script to print the following pattern in most optimal way i.e. in one for loop: * ** *** ****

Interview Answers

Anonymous

May 12, 2019

for i in n: print("*"*i)

Anonymous

May 12, 2019

print(" ".join([("*"*i) for i in range(10)]))