Python comes pre-installed on Linux OS. For Windows you will have to Download. Download Python here
Use a text-editor of your choice:
Recommended are:
Visual Studio Code Atom Sublime Text
Note that you have to pass the challenges in git and github to proceed to the next stages. They are essential tools in development for code sharing and collaboration.
Raise an Issue if encountering a blocker
Week 2
- Collections (list, arrays, ranges)
- Loops
- Functions
- Functions with Parameters
- Modules & Packages
- JSON with Python
- Decorators
Week 3
- Formatting & Linting
- Lambdas
- Classes
- Inheritance
- Mixins
- File System Management
- Asynchronous Programming
Week 4: Data Tools
- Jupyter Notebooks
- Anaconda, Conda & Colabs
- Introduction to Pandas
- Pandas: dataframe contents
- Pandas: dataframe querry
- CSV files & Jupyter
- Read/Write CSV Files with Pandas
Week 5: Data Tools
- Removing & Splitting dataframe columns
- Duplicate rows & Missing Values
- Split Testing & Data Training with scikit learn
- Train linear Regression Model with scikit learn
- Model testing
- Numpy & Pandas
- Visualizing data with Matplotlib
Preferably version 3,
As the Bootcamp is open to anyone, we encourage members of our community, Facebook Developers Circle Nairobi at Zetech University to actively engange in the activities.
-
Fork the repo to your GitHub Account. Guide
-
Create a new branch with a name in conjuction to your update/fix
# WEEK 1: Introduction
-
The print function allows you to send output to the terminal
Strings can be enclosed in single quotes or double quotes
- "this is a string"
- 'this is also a string'
The input function allows you to prompt a user for a value
Parameters:
prompt
: Message to display to the user
return value:
- string value containing value entered by user
-
Python can store and manipulate numbers. Python has two types of numeric values: integers (whole numbers) or float (numbers with decimal places)
When naming variables follow the PEP-8 Style Guide for Python Code
Converting to numeric values
-
Python can store and manipulate strings. Strings can be enclosed in single or double quotes. There are a number of string methods you can use to manipulate and work with strings
Converting to string values
When naming variables follow the PEP-8 Style Guide for Python Code
-
The datetime module contains a number of classes for manipulating dates and times.
Date and time types:
date
stores year, month, and daytime
stores hour, minute, and seconddatetime
stores year, month, day, hour, minute, and secondtimedelta
a duration of time between two dates, times, or datetimes
When naming variables follow the PEP-8 Style Guide for Python Code
Converting from string to datetime
-
Error handling in Python is managed through the use of try/except/finally
Python has numerous built-in exceptions. When creating
except
blocks, they need to be created from most specific to most generic according to the hierarchy. -
Conditional execution can be completed using the if statement
if
syntaxif expression: # code to execute else: # code to execute
- < less than
- < greater than
- == is equal to
- >= greater than or equal to
- <= less than or equal to
- != not equal to
-
Conditional execution can be completed using the if statement. Adding
elif
allows you to check multiple conditionsif
syntaxif expression: # code to execute elif expression: # code to execute else: # code to execute
- x or y - If either x OR y is true, the expression is executed
- < less than
- < greater than
- == is equal to
- >= greater than or equal to
- <= less than or equal to
- != not equal to
- x in [a,b,c] Does x match the value of a, b, or c
# Week 2: The Basics
-
Collections are groups of items. Python supports several types of collections. Three of the most common are dictionaries, lists and arrays.
Lists are a collection of items. Lists can be expanded or contracted as needed, and can contain any data type. Lists are most commonly used to store a single column collection of information, however it is possible to nest lists
Arrays are similar to lists, however are designed to store a uniform basic data type, such as integers or floating point numbers.
Dictionaries are key/value pairs of a collection of items. Unlike a list where items can only be accessed by their index or value, dictionaries use keys to identify each item.
-
For loops takes each item in an array or collection in order, and assigns it to the variable you define.
names = ['Christopher', 'Susan'] for name in names: print(name)
While loops perform an operation as long as a condition is true.
names = ['Christopher', 'Susan'] index = 0 while index < len(names): name = names[index] print(name) index = index + 1
-
Functions allow you to take code that is repeated and move it to a module that can be called when needed. Functions are defined with the
def
keyword and must be declared before the function is called in your code. Functions can accept parameters and return values.def functionname(parameter): # code to execute return value
-
Functions allow you to take code that is repeated and move it to a module that can be called when needed. Functions are defined with the
def
keyword and must be declared before the function is called in your code. Functions can accept one or more parameters and return values.def function_name(parameter): # code to execute return value
Parameters can be assigned a default value making them optional when the function is called.
def function_name(parameter=default): # code to execute return value
When you call a function you may specify the values for the parameters using positional or named notation
def function_name(parameter1, parameter2): # code to execute return value # Positional notation pass in arguments in same order as parameters are declared result = function_name(value1,value2) # Named notation result = function_name(parameter1=value1, parameter2=value2)
-
Modules allow you to store reusable blocks of code, such as functions, in separate files. They're referenced by using the
import
statement.# import module as namespace import helpers helpers.display('Not a warning') # import all into current namespace from helpers import * display('Not a warning') # import specific items into current namespace from helpers import display display('Not a warning')
Distribution packages are external archive files which contain resources such as classes and functions. Most every application you create will make use of one or more packages. Imports from packages follow the same syntax as modules you've created. The Python Package index contains a full list of packages you can install using pip.
Virtual environments allow you to install packages into an isolated folder. This allows you to better manage versions.
-
Many APIs return data in JSON, JavaScript Object Notation. JSON is a standard format that can is readable by humans and parsed or generated by code.
JSON is built on two structures:
- collections of key/value pairs
- lists of values
JSON Linters will format JSON so it easier to read by a human. The following website have JSON linters:
Python includes a json module which helps you encode and decode JSON
-
Decorators are similar to attributes in that they add meaning or functionality to blocks of code in Python. They're frequently used in frameworks such as Flask or Django. The most common interaction you'll have with decorators as a Python developer is through using them rather than creating them.
# Example decorator @log(True) def sample_function(): print('this is a sample function')