LagiLogi

My little island on the internet

Python Cheat Sheet

Python logo and python code in the backgroundI started learning to code Python a while back on Sololearn. But as a rookie it’s a lot of information and I tend to forget some that I learned in previous lessons. That is why I decided to make a Python Cheat Sheet.

I’m currently going through the Python Core course. You’ll find my progress below. More code will be added to the Cheat Sheet as I go through the lessons.

Note that some text is taken directly from the lessons of Sololearn, because I could not think of a way to write it any clearer.

If there is anything wrong in the Python Cheat Sheet, please let me know what is wrong and what it is correct instead.

Table of contents

– 7/7 – Basic concepts
– 10/10 – Strings and Variables
– 13/13 – Controls Structures
– 10/10 – Functions and Modules
– 11/11 – Exceptions and Files
– 4/11 – More Types
– 0/10 – Functional Programming
– 0/10 – OOP
– 0/9 – Regular Expressions
– 0/12 – Pythionicness & Packaging

The numbers show how many lessons out of X amount I have completed. Click any of the listed items to go to their part in the cheat sheet!

Python Cheat Sheet

This is the start of the Python cheat sheet. All information you find here is what I learned through the Sololearn Python Core course and might not contain what you’re looking for. Nonetheless it’s worth having a look at the beauty that is Python.

Basic Concepts

print() is a statement and needs to be followed by (), which are called parentheses. In between the parentheses you have data types. There are 3 different data types:
* String -> can contain both letters and numbers and need to be always enclosed within single or double quotes. Without quotes, text will give an error. Numbers will be integers or floats instead. Example: “I have 5 apples” or ‘You are 13 years old’.
* Integer -> Is a number that has no decimals. Example: 5, 20, 40432, -16, -999
* Float -> Is a number that always has a decimal. Example: 1.014.39, -74.8, -3.1123

Functions are blocks of code that only run when called
Arguments are values and can be changed every time you call a function
Parameters are used when defining the function.
For example:

def function_name(parameter):
— print(parameter)
function_name(7)
Output: 7

The parameter is para and the argument is 7

WORK IN PROGRESS – MORE COMING SOON!

Leave a Comment

Your email address will not be published. Required fields are marked *

Related posts
Computer Parts Explained

Computer parts explained

I was doing some research for a new laptop and realized that I don’t actually know what computer parts do what. In case you’re interested

Read More »