DEV Community

Cover image for Python Cheatsheet 🔥

Python Cheatsheet 🔥

Mohit Tanwaniâš¡ on July 15, 2021

Cheatsheets are good when you want to revise some of the concepts, but not an idle way to start learning I would recommend you to learn in depth f...
Collapse
 
m4r4v profile image
m4r4v

Great article, very handy and useful.
A simple suggestion to make it available for everyone, put the output after the input so people who don't know python or are starting with it, can know what to expect.

Happy Coding!

Collapse
 
tanwanimohit profile image
Mohit Tanwaniâš¡

Thanks Jorge, Will surely try to edit.

Collapse
 
chimichanga17 profile image
Rajesh G

wow! This was awesome.
Can you make this available as a PDF to download?
It'll be helpful to people
I loved this

Collapse
 
tanwanimohit profile image
Mohit Tanwaniâš¡
Collapse
 
josephsayler profile image
Joseph Sayler • Edited

just an FYI, in the more current versions of Python, dictionaries ARE ordered. to get this functionality in older versions (3.5 or less i think) you can use orderedDict

also for file io, use keyword 'with' to auto close a file you are working on. so do 'with filename as f: ...' and after you are done working with the file, it will be closed

and if you are new to python, master comprehensions (like list and dict) and make use of lambdas

Collapse
 
rafaelbo profile image
RafaelBo

Very valuable. Thanks for your work!
Just one input from my side:
I usually try to avoid double-under functions:
Under Basic Usage of dictionaries, I'd prefer:
print("apple" in prices)
over
print(prices._ _ contains _ _("apple"))

But maybe that's just personal preference.
Otherwise great work!

Collapse
 
aatmaj profile image
Aatmaj

Superb! I will definately mention this in my Learning Python course

Collapse
 
giridharsalana profile image
Giridhar Salana

Very Handy... But there is a typo in while loop header (spelled as white loop).

Collapse
 
tanwanimohit profile image
Mohit Tanwaniâš¡

Hey Thanks for telling! Fixed :)

Collapse
 
ffpaiki profile image
Fridolin Febrianto Paiki

Great job... This could really help me on my class

Collapse
 
nec2005 profile image
Nec2005 • Edited

Very useful for beginners. Thanks very much for your sharing.

Collapse
 
javad_gheisari profile image
Javad Gheisari

very useful.
thanks for your sharing