Sorry for asking this very basic question – but I cannot understand why it does what it does.
a = int(input('Enter No. of rows')) for i in range (a,0,-1): print(i*'*')
Thank you taking time to review and answer this question.
range function accepts three arguments. The first arg. represents the starting integer, the second arg. represents the integer at which to stop, and the 3 arg. represents how much should the numbers increase by. Therefore, in this case,
(start, stop, step) = (a, 0, -1). This basically means start from
a (the inputted value), move till
0 and increment by
Then, in each iteration, the asterisk symbol (
i many times, is printed.