Get fancy with Python.

People should think you're the best Python programmer after reading this blog!

Aug. 2, 2020 |  Categories:  Programming  

By Noah Jefferson, Developer

Get fancy with Python. There are a lot of shortcuts out there, I bet you didn't know!


Use Tab for indenting


Use Shift+Tab to unindent 


To comment out a bunch of code, or uncomment a bunch of code, use Ctrl+/ for Windows and Command+/ for MacOS.

 To enclose some text inside quotes, select the text and then, press Shift+' or Shift+".

 List comprehensions

The best part about Python is that you can do so much in so less of code. If you want to create a list of numbers in a certain range, you can do it extremely easily with this one line of code.

Image for post

You can add conditions to it easily too.

Image for post

Look at the below example. You can either do it like this with 6 lines of code,

Image for post

or, do it all together, using only 2 lines.

Image for post

Lambda Functions

Using lambdas, you can define a function right inside a variable! The syntax is like this:

multiply = lambda x, y: x*y


# Multiplies 2 and 3



Leave a comment: