maximum and minimum element from the list and return output in dict - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: maximum and minimum element from the list and return output in dict (/thread-1424.html) |
maximum and minimum element from the list and return output in dict - MeeranRizvi - Jan-02-2017 Hi guys, Find maximum and minimum element from the list and return output in dict i.e dict:{'Minimum : value,'Maximum':value'} i am having a list of values lis=[10,25,45,7,90]i just need to find the max and min value in the list and return the output in dictionary. This is what i tried using built in func to find the max and min value lis=[10,25,45,7,90] maxi=max(lis) mini=min(lis)but how to return those outputs in dictionary format? RE: maximum and minimum element from the list and return output in dict - ichabod801 - Jan-02-2017 When you talk about returning output, it sounds like you are meant to use a function, but that's not clear. If you are supposed to use a function, you might want to look at the function basics tutorial. Dictionaries are easy. Not only is there a dictionary tutorial here, but your assignment gives you the basic syntax already: extremes = {'Maximum': 90, 'Minimum': 7} |