Python Forum
Need help returning min() value of list?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help returning min() value of list?
#1
Howdy,

I have a feeling that my issue lies within my second function. The Max function works for returning the single highest digit however the min function returns a blank value

lst = []


def sort_max():
    max(lst)
    return (sorted(max(list(lst)))[-1])

def sort_min():
    min(lst)
    return (sorted(min(list(lst)))[+1])

while True:
    usrInput = (input("List "))
    if usrInput == "":
        print("Min", sort_min(), "Max", sort_max())
        break
    lst.append(usrInput)
Reply


Messages In This Thread
Need help returning min() value of list? - by edwdas - Nov-10-2019, 04:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  list.sort() returning None SmallCoder14 8 570 Mar-19-2024, 09:49 PM
Last Post: SmallCoder14
  returning a List of Lists nafshar 3 1,068 Oct-28-2022, 06:28 PM
Last Post: deanhystad
  2d List not returning DariusKsm 2 1,703 Sep-22-2020, 05:11 PM
Last Post: DariusKsm
  API call returning list value of 'None' jimbone30 5 2,582 Jun-14-2019, 07:42 PM
Last Post: jimbone30

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020