+ 2

Anyone please help me printing the following pattern using single for loop in python.. 5...4 5....3 4 5...2 3 4 5....1 2 3 4 5

Input should be taken from the user. Please use single for loop.. Please help me in this

9th Jul 2020, 2:48 AM
sarada lakshmi
sarada lakshmi - avatar
18 ответов
+ 4
sarada lakshmi I didn't helped you, no need for thanks
9th Jul 2020, 4:47 AM
Arctic Fox
Arctic Fox - avatar
+ 4
Welcome sarada Lakshmi
10th Jul 2020, 2:06 PM
TEMPER.xi
TEMPER.xi - avatar
+ 3
Please show us your attempt first so that we can help you..
9th Jul 2020, 2:54 AM
Arctic Fox
Arctic Fox - avatar
+ 3
sarada lakshmi Please give me the pattern clearly.... or show us your attempt, so that we can understand the pattern
9th Jul 2020, 3:18 AM
Arctic Fox
Arctic Fox - avatar
9th Jul 2020, 4:50 AM
Saphal Poudyal
Saphal Poudyal - avatar
+ 2
This is a good way r = 5 for i in range(r): print(range(n-i,n+i))
9th Jul 2020, 8:17 PM
TEMPER.xi
TEMPER.xi - avatar
+ 1
꧁༒Rishabh༒꧂ and 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 5 4 5 3 4 5 2 3 4 5 1 2 3 4 5 My approach : n=int(input()) for i in range(n) : for j in range(n-i, n+1): print(j, end=" ") print()
9th Jul 2020, 4:29 AM
sarada lakshmi
sarada lakshmi - avatar
+ 1
Thanks alot 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 ,꧁༒Rishabh༒꧂ and Ćheyat Thanks for helping me 👍
9th Jul 2020, 4:40 AM
sarada lakshmi
sarada lakshmi - avatar
+ 1
In cpp we can do it like int x=5; for(int i=0;i<5;i++) { for(int j=x-i;j<6;j++) { cout<<j<<" "; } cout<<endl; }
10th Jul 2020, 1:53 PM
Harsh Kant
Harsh Kant - avatar
+ 1
Thanks Dani N and Harsh Kant
10th Jul 2020, 2:04 PM
sarada lakshmi
sarada lakshmi - avatar
0
sarada lakshmi Kindly Provide your attempt.
9th Jul 2020, 2:59 AM
Saphal Poudyal
Saphal Poudyal - avatar
- 1
꧁༒Rishabh༒꧂ Ćheyat i can able to do it using 2 for loops.. But, not getting any idea to write the program using one for loop.. That's the reason why I posed question here.. If you know, please help me out..!!
9th Jul 2020, 3:15 AM
sarada lakshmi
sarada lakshmi - avatar
21st Jul 2020, 1:11 AM
shubham kumar
shubham kumar - avatar