0
Code to display this.
5 4 3 2 1 5 4 3 2 5 4 3 5 4 5
9 Respostas
+ 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.
+ 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;
}
+ 3
sorry Maninder Singh ,Anna ,prachal goyal I was in a hurry and did something bad đ«đ„đ„đit won't happen again sorry again đđ
+ 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()
+ 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.
+ 2
For practice problem.
https://projecteuler.net/archives;page=2
Another resources to learn python in deep and how it work.
Python Tutorials: https://www.youtube.com/playlist?list=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU
https://www.geeksforgeeks.org/python-programming-language/
+ 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.đ
+ 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?