Python program that prints a star pattern

preview_player
Показать описание
Python program creates a simple star pattern by using two nested for loops. The outer loop iterates through the rows and the inner loop iterates through the columns of each row. The range(1,6) in the outer loop specifies that the loop should run 5 times, creating 5 rows. The range(1,i+1) in the inner loop specifies that the loop should run from 1 to the current value of the outer loop variable i, so it creates columns that increase in number with each row. The print("*",end="") statement within the inner loop prints a star character in each column of the current row. The print() statement after the inner loop creates a new line for the next row.
Рекомендации по теме