codingdirectional: Return a reverse order list for a number with python

Hello people, this will be the last article which we will solve a simple question in CodeWars, in the next chapter we will start our next python project. In this chapter, we will solve one of the questions in CodeWars and the question goes like this.

Given a number, find the reverse order’s numbers of that number until one and put them in a list. For example, number 6 will make the method to return a list of reverse numbers up until 1, [6,5,4,3,2,1]. Below is the solution.

 def reverse_seq(n):      list_ = []     while(n > 0):         list_.append(n)         n -= 1     return list_ 

So we have solved that simple question on CodeWars and we have received 2 kyu from our hard work. With that, we have temporary concluded the question solving chapter and will start our next python project in the next chapter.

Planet Python

Leave a Reply

Your email address will not be published. Required fields are marked *