+ 14

Need code on Python

User chooses 5 numbers. ex: a=1 b=3 c=7 d=4 e=2 Program doing this: c>d>b>e>a Can anyone write a code like this with input?

22nd May 2018, 10:53 AM
Ayastar
Ayastar - avatar
6 Respostas
22nd May 2018, 11:27 AM
🌛DT🌜
🌛DT🌜 - avatar
+ 4
You want to sort them?Or you want to find max?
22nd May 2018, 11:04 AM
Mitali
Mitali - avatar
+ 4
YOU can! input numbers with separator. put it into a list. use sort method. print it formatted.
22nd May 2018, 4:52 PM
tamaslud
tamaslud - avatar
+ 3
numbers = sorted(list(input())) result = "" for x in range(len(numbers)): result = result + numbers[x] print(result) http://www.sololearn.com/app/JUMP_LINK__&&__python__&&__JUMP_LINK/playground/cDWYZWeYBJE5/
22nd May 2018, 12:33 PM
Hampus Mathiesen
Hampus Mathiesen - avatar
+ 2
Using sort() should work, but you can also take a look at this: https://www.sololearn.com/learn/774/
29th May 2018, 4:45 AM
Pedro Demingos
Pedro Demingos - avatar
+ 2
list = [1,3,7,4,2] list.sort(reverse = True) print( "sorted list is:" ,list) this will work
29th May 2018, 5:06 PM
AISHWARYA KASTHALA
AISHWARYA KASTHALA - avatar