[Tutor] Getting greatest 3 numbers from list

Alan Gauld alan.gauld at yahoo.co.uk
Mon Feb 21 09:35:31 EST 2022


On 21/02/2022 13:46, Manprit Singh wrote:

> This is not related to python, but a general question, in c++ we have sets
> in standard template library and iterators, and sets are basically sorted,
> So doing the same problem in c++ using sets is a bad idea ?

No, it would seem to be an excellent idea, taking advantage
of a feature of the standard library.

> My apologies for posting c++ code if it is against the rule of python
> mailing list

It's allowed for comparison purposes or if you have a problem
interfacing C++ with Python. But be aware that most readers
probably won't be able to understand it and even fewer will
be in a position to offer meaningful critique.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list