Learn Python The Right Way

The best place to learn, code, visualize, share Python Codes (and many more..)

Python is simple to learn and, due to its wide range of applications, it is one of the most widely used programming languages today. Several studies have shown that as a Python beginner, you will be job-ready in less time than other programming language beginners.

- Learn about Python Match and Case statement (Switch statement) introduced in Python 3.10

#1 Tips of the Day
Printing String n Times

n = 2
i = "pythontherightway"
print(i * n)
Run Online
#2 Tips of the Day
Reverse a string

i = "pythontherightway"
reverse = i[::-1]
Run Online

Must know in PY ecosystem

Latest Python version is 3.11

PYPI helps us find and install python software projects and libraries

The default Implementation of Python we use is CPython which is written in C programming language

PyCon is the conference for the Python community by the Python Community

Some Quick Python Language Tips

Lets use sys.getsizeof() to check objects memory usage. It returns the size of object in bytes

import sys
my_list = [1,2,3,4,5,6,7,8,9,10]
print(sys.getsizeof(my_list)) #output in bytes

a = 10
print(sys.getsizeof(a)) #output in bytes

Sometime naming a function is not a worth because of its one time use of use on map(),filter(),reduce() functions.

add=lambda x,y:x+y

antigravity module is one of the easter eggs released by Python developers

when you import antigravity module, it opens up a web browser pointing to classic XKCD comic about python (https://xkcd.com/353/)

>>> import antigravity

# Opens up a web browser pointing to https://xkcd.com/353/


Sometime you might want to use curly braces in your code rather than some whitespaces and indentation that python follows

Well, Probably you won't be able to do that in python

from __future__ import braces
File "main.py", line 1
from __future__ import braces
SyntaxError: not a chance

Note: SyntaxError: Note: SyntaxError: