Python Program to Print Numbers from 10 to 1 in Reverse Order using While Loop

Python Program to Print Numbers from 10 to 1 in Reverse Order using While Loop

In this article, we will be solving question based on Iteration using while loop in Python. According to the question we have to print the numbers from 10 to 1 in reverse order using while loop.

If you like the article content, then share it in your coding groups so that more people can take advantage of the content. So, without wasting any time let's solve this question.

Question - Write a Python Program to Print Numbers from 10 to 1 in Reverse Order using While Loop

Python Program to Print Numbers from 10 to 1 in Reverse Order using While Loop


Logic and Explanation

Question - Write a Python Program to Print Numbers from 10 to 1 in Reverse Order using While Loop

Python Program to Print Numbers from 10 to 1 in Reverse Order using While Loop - In this program we have to use while loop only. 

So for this we will give first create a variable i initially equal to 10. Then, we will use while loop with condition that till i > 0, we have to print the value of i and also after printing we will decrease it's value from 1. In this way, we can print Numbers from 10 to 1 in Reverse Order using While Loop. 

You can also extend this program from printing numbers from some n to 1 in reverse order. In this you will have to set the initial value of i equal to n. That's simple was this program based on simple looping concept. I think the logic the behind writing the code is clear to you.

Also Read - Python Program to Separate Numbers and Letters in a String


Here's the code for the same.

i = 10
while i > 0:
    print(i)
    i = i - 1


So, I hope you liked the article and you would have found the content of the article useful and helpful for you. Share this article in your coding communities so that more people can take advantage of the content. Also, In case of any doubt feel free to ask in the comments below.

For More Such Python Programs - Click Here

Enjoy Coding!!!


Also Read :-

Extract Phone Number Details Using Python





For any doubts feel free to ask in comments below.
Stay Connected to Us for more such Courses and Projects.

Post a Comment

For any doubts feel free to ask in comments below.
Stay Connected to Us for more such Courses and Projects.

Post a Comment (0)

Previous Post Next Post