Python Pattern Programs - Printing Stars in Hollow Right Triangle Shape

preview_player
Показать описание
In this Python Pattern Printing Programs video tutorial you will learn to print star '*' in hollow right triangle shape in detail.

For more free tutorials on computer programming
Рекомендации по теме
Комментарии
Автор

Here is the correct code below 👇

N = int(input())
for row in range(0, N):
for col in range(0, N):
if col == N-1 or row == 0 or col == row:
print("*", end=" ")
else:
print(" ", end=" ")
print()

NIKHILKUMAR-uqgn
Автор

Thanks a lot Amula you are the best,
Update code:
rows = int(input("Enter Numbers of rows:> "))
for row in range(rows):
for col in range(rows):
if row == 0 or col == rows - 1 or row == col:
print('*', end=' ')
else:
print(' ', end=' ')
print()

amrantar
Автор

Nice way of explaination. Watching 7.8.24

User-hhssjqyw
Автор

hi, 1stly thanks for teaching in such a brilliant way. U made python very easy to understand. Now my query is that if we write print(end="*") instead of print("*", end=""), we get the same result result then why don't we write in the first way?

aditiprashar
Автор

*Can u please make video for practice programs in Dictionary... I want to learn how to write programs in dictionary from u... U explain really good... Please help.!*

HarshitaChattopadhyay
Автор

Thank you so much, your content is helping me a lot these days👏👍

maheshappaji
Автор

Hi, what if we want space between the each star in row and get the hollow right angle triangle. Can you explain it

surabhiakhila
Автор

I like your voice..😍and explanation take a bow.

victoryvertexuniverse
Автор

i tried your code i got an inappropriate output
can you suggest, mistake made by me ....
n = int(input())
for row in range(0, n):
for col in range(0, n):
if row==0 or col==(n-1) or row==col:
print('* ', end="")
else:
print(end=" ")
print()

svvvreddy
Автор

n=int(input())
for row in range (0, n):
for colu in range(0, n):
if row==colu or row==0 or colu==n-1:
print("* ", end="")
else:
print(end=" ")
print()

subbubala
Автор

for row in range(5) :
for col in range(5) :
if row==0 or col==4 or row==col:
print("*", end=" ")
else:
print(end=" ")
print()

stayconnectedhere
Автор

Hi Amulya,


The above mentioned program doesn't work. Here's the program. Could you check?


n= int(input("enter the no of rows:"))
for r in range(0, n):
for c in range(0, n):
if r==0 or c==(n-1) or r==c:
print('*', end = '')
else:
print(end='')
print()


Thanks!

nehaseth
Автор

correct code
n = int(input('Enter an integer number: '))
for rows in range(n):
for columns in range (n):
if rows==0 or columns==(n-1) or rows==columns:
print('*', end='')
else:
print(end=' ')
print()

jayantamasanta
Автор

Madam, row and col evi = cheyalli
Space or stsrs ?

imursrajesh
Автор

agr * do bar call karega to kya ye extra memory use krega

harshvardhan
Автор

if i want space after each star how can i write the program

adityanarayannayak
Автор

hey there, could you please upload a video on how to print stars in shape of right angle with no hollow space?

satvikchaturvedi
Автор

please explain the else part space because they work when the if condition is wrong in this code if condition is not wrong please explain line by line working

jhonjhon
Автор

How about parallelogram shape? can it also be constructed?

markcalds
Автор

it does not the last line not come and plz if possible in while loop then plz give me some idea

kalpatarunayak