How can I write a code which compares numbers (written by the spectator) and then shows these numbers in ascending or descending order.*and works with any quantity of numbers. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I write a code which compares numbers (written by the spectator) and then shows these numbers in ascending or descending order.*and works with any quantity of numbers.

Greater than, less than

12th Aug 2016, 12:32 PM
María José De la Torre
María José De la Torre - avatar
2 Answers
0
https://ghostbin.com/paste/akfu6 This is an example where you write the numbers but you can place instead of the numbers inside the array some variables with user data.
14th Aug 2016, 9:22 PM
Gabriel Popa
Gabriel Popa - avatar
0
numbers = [] answer = 'yes' while answer == 'yes': x =int(input('give me a number')) numbers.append(x) answer = input('do you want to enter a new number?') numbers.sort() descendent = numbers[::-1] print(descendent) it works on computer, in the application you cannot manage the answer -input.
27th Nov 2016, 2:30 PM
Benedek Máté Tóth
Benedek Máté Tóth - avatar