Python CHEAT sheet

👇🧵 Highlights and download

1. Base Types

For calculations
✔️ int + float

For program flow
✔️ bool

For text and data
✔️ str + bytes

2. Data Structures

Most common
✔️ list + dict

Common indirect use
✔️ tuple

3. Variable Assignment

✔️ a = b = c = 0 # same value
✔️ a, b = b, c # swap values

4. Conversions

"one two three" -> "one-two-three"
'-'.join("one two three".split())

5. Conditional Statement

Check if in list:
if item in ['foo', 'bar']:
# item is foo or bar
# item not foo or bar

6. Boolean Logic

Priority is NOT, then AND, then OR

True or False and False -> TRUE

7. Display and Input

f-string example

name = Python
age = 2023 - 1991
print(f'{name} is {age} years old')

The full cheat sheet includes
✔️ loops
✔️ files
✔️ sequences
✔️ list + dict operations
✔️ string operations
...and much more

More from Learn Python With Rune

Want to learn Django?

Check out these 8 free resources.

see 👇🧵

Get started with Django

- Installing and creating first project
- Working with templates
- Authentication frameworks
...and much more

More resources

Django Admin Cookbook

How to do things with Django admin
- Create two admin sites
- Bulk and custom actions
- Working with permissions
...and much more

More 👇🧵

Django ORM cookbook

How to do things using Django ORM
- How to do OR/AND queries in ORM
- CRUD with ORM
- Database modelling
...and much more

More 👇🧵

Building APIs with Django and Django Rest Framework

Learn about
- Simple API with pure Django
- Serializing and Deserializing data
- Access control
...and much more

More 👇🧵
Top 10 Data Science Projects with Python

✔️ 10 Datasets
✔️ 10 Projects with solution


1️⃣ Project: Detecting Spam

✔️ Big email dataset
✔️ 35.000+ spam and ham messages
✔️ Learn how to filter

Solution 👇🧵

1️⃣ Solution: Detecting Spam

✔️ How to build a spam filter
✔️ Using Scikit-learn
✔️ Naive-Bayes and

2️⃣ Project: Music Recommendation

✔️ Million Song Dataset
✔️ Metadata for a million songs

Solution 👇🧵

2️⃣ Solution: Music Recommendation

✔️ Using Tableau
✔️ Collaborative-filtering engine
✔️ Similar to YouTube

More from All

APIs in general are so powerful.

Best 5 public APIs you can use to build your next project:

1. Number Verification API

A RESTful JSON API for national and international phone number validation.


2. OpenAI API

ChatGPT is an outstanding tool. Build your own API applications with OpenAI API.


3. Currency Data API

Currency Data API provides a simple REST API with real-time and historical exchange rates for 168 world currencies


4. Weather API

Real-Time & historical world weather data API.

Retrieve instant, accurate weather information for
any location in the world in lightweight JSON format.


You May Also Like

“We don’t negotiate salaries” is a negotiation tactic.

Always. No, your company is not an exception.

A tactic I don’t appreciate at all because of how unfairly it penalizes low-leverage, junior employees, and those loyal enough not to question it, but that’s negotiation for you after all. Weaponized information asymmetry.

Listen to Aditya

And by the way, you should never be worried that an offer would be withdrawn if you politely negotiate.

I have seen this happen *extremely* rarely, mostly to women, and anyway is a giant red flag. It suggests you probably didn’t want to work there.

You wish there was no negotiating so it would all be more fair? I feel you, but it’s not happening.

Instead, negotiate hard, use your privilege, and then go and share numbers with your underrepresented and underpaid colleagues. […]