price=[10,20,4,5,4,6,46,43,4,64,65,8,45,55,558,15,5,4,6,5,255,5] price.sort() price.reverse() max=price[0] sec_max=price[1] print(price) print(f"the max is {max}, runner up is {sec_max}")
Here is what the above code is Doing:
1. We have a list of integers called price.
2. We sort the list in reverse order.
3. We store the first element of the list in a variable called max.
4. We store the second element of the list in a variable called sec_max.
5. We print the list.
6. We print the max and sec_max variables.