0

Code to display this.

5 4 3 2 1 5 4 3 2 5 4 3 5 4 5

4th Oct 2018, 8:51 AM
partha
partha - avatar
9 Answers
+ 7
partha, sorry, but seriously? Asking others to do your homework for you without a single "please" or "thank you", and if you're not satisifed with someone's answer, you downvote them? That's extremely rude and I think future posts like this should just be ignored. prachal goyal's code looks like pseudo-code. It's not an actual working code, but they're showing you a way how to achieve what you want. All you need to do is "translate" it to python. I think that's the least you can do.
4th Oct 2018, 9:47 AM
Anna
Anna - avatar
+ 3
here N is number of input (here N will be 5 ) for(i=1; i<=N; i++) { for(j=N; j>i; j--) { print j value; } print new line; }
4th Oct 2018, 9:13 AM
prachal goyal
prachal goyal - avatar
+ 3
sorry Maninder Singh ,Anna ,prachal goyal I was in a hurry and did something bad đŸ˜«đŸ˜„đŸ˜„đŸ˜­it won't happen again sorry again 😓😓
4th Oct 2018, 12:07 PM
partha
partha - avatar
+ 2
partha this is solution but remember that you should try your code by yourself.always try and show your code if it wrong and we will help to improve it. for i in range(5): for h in range(5,i,-1): print(h,end=' ') print()
4th Oct 2018, 11:55 AM
Maninder $ingh
Maninder $ingh - avatar
+ 2
partha i think you need more practice on for loop. explanation of above code. for i in range(5): #means i starts from 0 and end at 4 because last element does not include as we know. for h in range(5,i,-1): #means h starts from 5 and end at i this for loop is in reverse order that's why step is -1. print(h,end=' ') #print h and end=' ' means next element print in same line. print() #this is use for print new line.it will run when 2nd for loop execution complete. i think you need to do more practice on how programmes work.go line by line and understand their execution. i think it will help you go to this link https://www.onlinegdb.com/online_python_debugger (best on pc) and copy above code and run your code in debug mode.just click on next step run your code line by line and every change in code will show in right side.it will help you how this programme work.
4th Oct 2018, 3:53 PM
Maninder $ingh
Maninder $ingh - avatar
4th Oct 2018, 4:07 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
Anna yeah... that's a pseudo-code .. partha p it is only for explaination anyway no prob
4th Oct 2018, 12:18 PM
prachal goyal
prachal goyal - avatar
+ 1
hey Maninder Singh I tried replacing h with '*' and it gave the '*' version of the above I think I'm lacking in the base. Can you please explain the basic working of this code and and what's exactly changed by replacing h with '*'(or something like '#') And yeah thanks guys for your guidance.😀
4th Oct 2018, 12:47 PM
partha
partha - avatar
+ 1
thanks a lot Maninder Singh and do you know any site or something to get a decent amount of examples on different functions and like that and practice problems?
4th Oct 2018, 4:03 PM
partha
partha - avatar