This video provides you with the solution to the challenge in the previous video.
- [Instructor] We start by importing all the packages…used in this chapter and by reconstructing…the goldmealist data set.…Finding the athletes with the most gold medals…is a simple application of collections.counter.…What we're counting is the number of times…that each athlete name appears.…Now we can call the most_common method…to see the five best, Paavi Nurmi, Carl Lewis…and Usain Bolt are tied at 9.…To find the athletes with medals in the most events,…we need to collect events won by every athlete.…
For this we use a defaultdict and it should be a defaultdict…of sets to avoid repeating the same event.…So we go through the medals and we build the dict,…adding two sets that will start as empty…then we can turn the dict into a list,…sorted by the number of different events.…Remember that items is iterate that returns key/value pairs,…the key will be the athlete and the value will be…the set of events.…So we can then call sorted with a key function…that counts the elements in the set.…
We need to make a special function for that,…
- Designing efficient loops
- Exploiting Python collections
- Writing Pythonic code
- Choosing the best libraries for your tasks
- Downloading webpages with requests
- Parsing HTML with Beautiful Soup
- Manipulating images with Pillow
- Making videos and drawing on maps with matplotlib
- Serving webpages with Jinja2 and Flask
- Working with Python classes
- Taking advantage of functional techniques
- Profiling CPU and memory use
- Exploiting parallelism
Skill Level Intermediate
Learning Python Web Penetration Testingwith Christian Martorella2h 49m Intermediate
1. Installation and Setup
Jupyter notebooks3m 19s
2. Writing Python Efficiently
3. Exploiting Python Libraries
4. Advanced: Python Object-Oriented and Functional Programming
5. Introduction to Performance Optimization in Python
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.