Pylenin Weekly #14

List comprehension, interesting data sets and suggestion box for my next blog.

Pylenin Weekly #14

Welcome to Pylenin Weekly #14, a newsletter dedicated to improving the lives of my fellow peers through knowledge sharing in the field of programming and data.

This week, we are going to discuss List Comprehensions.

List comprehensions are used for creating lists based on iterables. In many cases, the syntax of list comprehension is more handy than using a for and if loop. List comprehensions are almost always faster than for loops.

To learn more about List Comprehensions, check out my blog.

Python List Comprehension (With Examples)
Learn to create and use lists comprehensions in Python 3 with examples.

List Comprehension Practice Problems

Once you are done, learning about list comprehension, here are some problems for you to solve!

  1. Using list comprehensions, create a list containing tuples of every word and its length from this given sentence - Pylenin writes blogs on Python
  2. Using list comprehensions, create a new list from the given list numbers, which contains only the positive numbers.
    numbers = [-9, 10.2, 11, 14, -5, -0.00001]

Some interesting data sets to work with ..

A lot of times, we want to experiment new ways of data wrangling using various data sets. But we don't know, where to pull data from.

Here are few sources from which you can easily pull data.

OpenSky Network

The OpenSky Network API API lets you retrieve live airspace information for research and non-commercial purposes. You can learn about where the different flights are currently, where they are going and much more.

The root URL of their REST API is:

https://opensky-network.org/api

Check out this link to learn more about this open source project.

Space Track

Space-Track.org promotes space flight safety, protection of the space environment and the peaceful use of space worldwide by sharing space situational awareness services and information with U.S. and international satellite owners/operators, academia and other entities.

The base url is -

https://www.space-track.org/

Check out this link to learn more about this open source project.


Python 3.11 is coming. What to expect?

Python newest version 3.11 is expected to be released in October 2022. The alpha version (3.11.0a6) is already out.

Here are some features that you can expect in Python 3.11.

  1. Handling multiple exceptions by using the new ExceptionGroup class.
  2. Better error messages to user through an improved traceback. Earlier, the interpreter would only point to the specific line causing the error. But now it will point to both the line and the specific expression causing the error.
  3. A brand new module called Tomllib to parse toml files.

I will prepare a blog on this shortly with more detailed explanations. Stay tuned!


I need suggestions..

I need your help to write my next blog. Please take a minute to send your suggestion using this form.


I hope you enjoyed this week's newsletter. See you again next week with some more interesting content.

FYI - You can support me continue this newsletter, by becoming a paid member of Pylenin. It doesn't cost much and has a lot of benefits!