John Deere interview question

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

Interview Answers

Anonymous

12 May 2019

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

Anonymous

12 May 2019

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