[Tutor] set as iterable

Stephen Malcolm stephen_malcolm at hotmail.com
Mon Sep 28 12:38:33 EDT 2020


Dear Manprit,

Thank you for the speedy response. This is my first Python exercise, so excuse my ignorance. Yes, you can pass a set as an argument to these functions, in place of an iterable....

Kind Regards,
Stephen

Sent from my iPhone

> On 2020. Sep 28., at 18:30, Mark Lawrence <breamoreboy at gmail.com> wrote:
> 
> On 28/09/2020 14:29, Manprit Singh wrote:
>> Dear sir ,
>> As you know there are lots of built in  functions in python standard
>> library that accept an iterable as an argument. Some of the functions are:
>> all , any, filter, map, max, min, sum, list, tuple, and so on, i will not
>> include functions like enumerate since set is an unordered collection . Can
>> I pass a set as an argument to these functions in place of an iterable ?
>> Regards
>> Manprit Singh
> 
> Why not try it from the interactive interpreter and see?
> 
> mark at mark-HP-15-Notebook-PC:~$ python3.8
> Python 3.8.5 (default, Sep 12 2020, 00:59:31)
> [GCC 9.3.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> a=set([1,9,5,6])
> >>> max(set([1,9,5,6]))
> 9
> 
> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list