Python Pattern Programs - Printing Stars '*' in Right Angle Triangle Shape

Amulya's Academy
Amulya's Academy
150.3 هزار بار بازدید - 8 سال پیش - In this Python Pattern Printing
In this Python Pattern Printing Programs video tutorial you will learn to print star '*' in right angle triangle shape.

To print star pyramid patterns in python you have to use two for loops. Program that prints pattern contains two for loops: the first loop is responsible for rows and the second for loop is responsible for columns.Here we want odd number of star in columns so we used one extra variable k.

If you are using Python 2 then if you write this code you will get error because in python 2 print is not a function and also we cant use end there so you need to use print as statement  and instead of end you need to use coma (,) at the end of print statement to get the same output.

in python 3 you write print like this:
print("*',end="")

in python 2 you need to write:
print "*",

For more free tutorials on computer programming
Facebook: AmulsAcademy
twitter.com/AmulsAcademy
8 سال پیش در تاریخ 1395/11/01 منتشر شده است.
150,306 بـار بازدید شده
... بیشتر