Python Pattern Programs - Printing Stars in Hollow Right Triangle Shape

Python Pattern Programs - Printing Stars in Hollow Right Triangle Shape

Amulya's Academy

6 лет назад

68,128 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Harsh Vardhan
Harsh Vardhan - 17.06.2023 21:10

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

Ответить
jaanu256
jaanu256 - 31.07.2022 20:21

Why we are taking 0,n why not n

Ответить
I'm Ur's Rajesh
I'm Ur's Rajesh - 31.07.2022 10:44

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

Ответить
Subbu Bala
Subbu Bala - 10.06.2022 05:44

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()

Ответить
Abhishek Kr
Abhishek Kr - 28.05.2022 21:59

Thanks ❤️

Ответить
Surabhi Akhila
Surabhi Akhila - 25.04.2022 10:43

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

Ответить
Entertainment Creations
Entertainment Creations - 04.03.2022 11:42

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()

not getting proper output

Ответить
NAGOOR BASHA BHEEMANAPATI
NAGOOR BASHA BHEEMANAPATI - 02.02.2022 14:52

good explanation

Ответить
NIKHIL KUMAR
NIKHIL KUMAR - 21.12.2021 15:50

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()

Ответить
Amr Antar
Amr Antar - 15.12.2021 15:33

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()

Ответить
Unique anime world
Unique anime world - 25.11.2021 20:46

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

Ответить
Vishnuvardana venkatareddy. sathi
Vishnuvardana venkatareddy. sathi - 24.10.2021 17:48

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()

Ответить
Aditya Narayan Nayak
Aditya Narayan Nayak - 14.10.2021 17:02

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

Ответить
Hamdi Nait Limam
Hamdi Nait Limam - 05.10.2021 18:15

Using one for loop and r.just:
n = int(input("Enter number of rows: "))
for i in range(1,n+1):
if i ==1:
print("*"*n)
elif i == n:
print("*".rjust(n," "))
else:
print("*".rjust(i, " ") + "*".rjust(n-i," "))

Ответить
Deepak kumar
Deepak kumar - 11.09.2021 20:26

Please make video in hindi

Ответить
Mahesh Appaji
Mahesh Appaji - 22.08.2021 13:54

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

Ответить
John Jessy
John Jessy - 17.08.2021 20:12

can you do this
Right Angled Triangle - 3
Given an integer number N as input. Write a program to print the right-angled triangular pattern of N rows as shown below.

Input
The first line of input is a positive integer.

Explanation
For example, if the given number is 5, the output should be

Sample Input 1
Sample Output 1
- - - - - -
| /
| /
| /
| /

Ответить
Debojit Mandal
Debojit Mandal - 28.06.2021 20:13

But I am getting this ****
*
*
*
*

Ответить
Stay Connected
Stay Connected - 10.09.2020 08:38

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()

Ответить
Vijay Sahal
Vijay Sahal - 27.06.2020 21:15

nice 👍🏻👍🏻👍🏻

Ответить
Sunil Patil
Sunil Patil - 05.06.2020 07:18

Best teaching👍

Ответить
MarkCalds
MarkCalds - 31.05.2020 04:34

How about parallelogram shape? can it also be constructed?

Ответить
Neha Seth
Neha Seth - 29.04.2020 15:07

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!

Ответить
कुंवर नितीश सिंह
कुंवर नितीश सिंह - 28.03.2020 08:33

Program will be not run python 3.0

Ответить
Jayanta Masanta
Jayanta Masanta - 15.01.2020 18:54

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()

Ответить
aditi prashar
aditi prashar - 26.10.2019 06:17

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?

Ответить
Harshita Chatterjee
Harshita Chatterjee - 30.09.2019 20:42

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.!

Ответить
The Dreamer
The Dreamer - 19.09.2019 13:00

Best tutor...

Ответить
Usha rani Mandla
Usha rani Mandla - 20.08.2019 20:44

Nice teaching...

Ответить
Shrinivas Nallol
Shrinivas Nallol - 26.02.2019 17:03

Hi can u send me same program with no space in between but in same shape

Ответить
kalpataru nayak
kalpataru nayak - 15.02.2019 23:19

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

Ответить
Gasha mir
Gasha mir - 04.02.2019 08:18

output is totally diff. can you plz resolve it .

Ответить
Manthan jadhav
Manthan jadhav - 26.12.2018 16:36

Its not working plz provide proper code

Ответить
ashok ballipalli
ashok ballipalli - 09.11.2018 17:22

This logic doesn't works I am not getting require out put

Ответить
Satvik Chaturvedi
Satvik Chaturvedi - 01.09.2018 22:00

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

Ответить
Chirag
Chirag - 27.05.2018 03:25

Hi Amulya ur beautiful teaching

Ответить
jhon jhon
jhon jhon - 31.03.2018 06:38

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

Ответить
jhon jhon
jhon jhon - 31.03.2018 06:38

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

Ответить
Bali Swathi
Bali Swathi - 07.01.2018 16:22

thank you mam

Ответить