+ 1

Help pls! Working with lists

In the list find the maximum element among the positive elements, of the list and the minimum among the negative elements

4th May 2020, 11:45 AM
PUFFIN Channel
PUFFIN Channel - avatar
5 Answers
+ 4
Use min() and max(). See the output from the console: >>> lst = [4,2,-4,11] >>> min(lst) -4 >>> max(lst) 11
4th May 2020, 11:50 AM
Lothar
Lothar - avatar
+ 2
Lothar , sololearn wrote that there is no output(
4th May 2020, 11:53 AM
PUFFIN Channel
PUFFIN Channel - avatar
+ 1
PUFFIN Channel, I mentioned that the try was done on the console - there you need no print() to get output. Sorry, I thought that are aware of this. 😉
4th May 2020, 1:44 PM
Lothar
Lothar - avatar
0
postiv_num =[2,10,5,20,13,78,1] nagtiv_num =[-1,-6,-7,-2,-9,-45,-78] Print (min(postiv_num)) Print (max(nagtiv_num)) #simple
4th May 2020, 1:30 PM
Uzochukwu Emmanuel
Uzochukwu Emmanuel - avatar