Welcome to the Python Guide

Programming Languages

Latest in Tech

Zettonia Education

Python Quickstart

There are 2 versions of Python. Python2 and Python3. While Python3 is new and it is faster than Python2, there are many systems that are still being run on Python2, so you may want to checkout which version suites your needs

If you are just starting out, let us start with Python3.6

Check out Anaconda, which is a nicely packaged data science tool with python and data science libraries.

The Python Syntax Ecosystem

Jump to:

Data Types  Variables  Conditional Statements  Loops  Functions  pip  virtual Environment 

Python Basics ( Python3 )

Data Types
  • Integer : Whole numbers
  • Float : Numbers with decimals
  • String : Text
  • Boolean : True or False
Data Structures
  • Lists : []
  • Dictionary : {}

Using IDLE:

Open IDLE, Python's Integrated Development Environment(IDE).

Create a new file and save it.

Output to commandline



# Comments are denoted with the hex symbol / hashtag. This line will be ignored by Python.


Declaring variables: It's kinda like Algebra

var_1 = "Hello"
var_2 = "World"

Variables with math operations: Here comes to Algebra

var_1 = 20
var_2 = 30
total = var_1 + var_2 print(total)

Variables with Lists and Dictionaries

# Try these codes. list_1[0] will return us the first value in the list
list_1 = [10,20,30]
# Try these codes
my_cat = {
   "name":"Mr. Fluffy",

If / Else If (elif) / Else Conditional Statements:

Comparison Operators Meaning
== Is equal to
> More than
< Less than
>= More than or equal to
<= Less than or equal to
!= Not Equal to
Boolean Operators
you_are = "hungry"
food_type = "pizza"

# if you are not hungry, go home
# else if you are hungry and hungry for pizza, go to pizza restaurant
# else go look for other restaurants

if you_are != "hungry":
     print("Go Home")
elif you_are == "hungry and food_type=="pizza":
     print("Go to Pizza Restaurant")
     print("Look for other restaurants")

# press tab to create the indentation for the print statement
# the indentation will create a block of code, for example the if block, the else if block

Loops: do something over a range or while something is true

# Try these codes out
for i in range(0,10):

my_list = ["Hello","There",10,20,30]
for item in my_list:

# Try these codes out
hungry = True
while hungry == True:
     print("I will have some pizza.")
     print("Done eating. Not hungry any more!")
     hungry = False
     # when we change hungry to False, we will exit the while loops

print("We are out of the while loop...")

Functions: Reusable blocks of codes

def are_you_hungry(a,b):
     # a is the parsed data. we can use "a" within this function. We will parse True or False
     if hungry == False:
          return("Go Home")
     elif hungry == True and b =="pizza":
          return("Go to Pizza Restaurant")
          return("Find some other restaurant")

# Calling the function with hugry,food_type
result = are_you_hungry(True,"pizza")


PIP is a package manager of Python. You can use the following commands in your terminal, powershell or command line after you have installed Python.
You can use it to install libraries like Pandas.

pip install pandas

pip uninstall pandas

To save the list of current packages into a file called requirements.txt.
We call them "dependencies" because without these packages, the programs depending on these packages will not work.

pip freeze > requirements.txt

To install dependencies from a list of packages called requirements.txt

pip install -r requirements.txt

Ready to dig deeper into Python?

Zettonia Education Programmes