Print star pattern using while loop in python

Python Pattern Programs using While Loop

In this tutorial, we will learn how to print patterns to console using Python While Loop.

Example 1 – Python Program to Print Right Triangle using While Loop

In this example, we will write a Python program to print the following start pattern to console. We shall read the number of rows and print starts as shown below.

Pattern

For an input number of 4, following would be the pattern.

*
* *
* * *
* * * *

Try Online

Python Program

n = int[input['Enter number of rows : ']]

i = 1
while i 

Chủ Đề