Why this code output nothing? (code in despcription) I am trying to get a inverted star pattern that is from many stars to less | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this code output nothing? (code in despcription) I am trying to get a inverted star pattern that is from many stars to less

a = "*" i = 20 for i in range(21,1) : i = i - 1 print(a*i)

18th Apr 2021, 6:17 AM
Tanishq Kamble
Tanishq Kamble - avatar
1 Answer
+ 5
You need to add the step to countdown in range(21, 1, -1) otherwise the for loop isn't entered. You can then remove the lines i = 20 i = i - 1
18th Apr 2021, 6:26 AM
ChaoticDawg
ChaoticDawg - avatar