Skip to content

Instantly share code, notes, and snippets.

View prodeveloper's full-sized avatar

Jacob Chencha prodeveloper

View GitHub Profile
@prodeveloper
prodeveloper / introduction_to_c9.md
Last active January 24, 2017 07:31
Introduction to C9

##Step 1

Register on c9.io

##Step 2

Select to create a new workspace

 photo Screen Shot 2017-01-22 at 10.16.03_zpsgadlnexa.png

@prodeveloper
prodeveloper / introduction_python.md
Last active January 31, 2017 06:11
Introduction to Python

##Step 1

Open up your workspace on c9.io and activate the bash.

Type in

python3
@prodeveloper
prodeveloper / working_scripts.md
Last active February 3, 2017 11:50
Working with Python scripts in c9

Today we will be saving our python scripts so that we can access them later.

Python scripts are text files that contain python code. Their filenames are appended with ".py

To create a script select create a new file

 photo Screen Shot 2017-02-02 at 15.50.27_zps0cinsxdq.png

Select to save the file

@prodeveloper
prodeveloper / using_input_python.md
Last active February 21, 2017 06:20
Working with dynamic information

In previous entries we have been mostly manipulating strings and numbers. The numbers have had to be hard set inside the file.

eg

area = 5 * 3
print(area)

This is obviously useful for learning, but in real world programming. You must admit input from the users.

@prodeveloper
prodeveloper / introduction_loops.md
Last active February 28, 2017 04:56
An introduction to working with loops and lists in python

##Step 1

In programming, recurrence happens a lot. In fact it can be said that the entire essence of programming is to automate recurring steps.

Suppose for example we needed to have python print out a list of all numbers between 1-10 how would we do it?

Lets first create the folder for the lesson. From the terminal type in

mkdir 5lesson
@prodeveloper
prodeveloper / introduction_functions.md
Created February 23, 2017 09:52
Introduction to functions in python

Functions are programming constructs that helps us package common operations. In addition they make our code that much more readable.

They have a format that looks like this:

def first_function():
        pass

output = first_function()
@prodeveloper
prodeveloper / conditionals.md
Last active March 7, 2017 07:37
Working with if statements in python

We make choices in everyday life. Each choice takes us to a different branch of steps.

For example, you can chose to come by Matatu or by an Uber. Each choice has steps that follow naturally from it.

Computers can also be programmed to make choices. In python, this is done by using the if, elif* and else key words.

if some_true_value:
        ##Run some series of steps 
elif some_other_true_value:
@prodeveloper
prodeveloper / working_with_libraries.md
Last active March 14, 2017 06:24
Working with libraries

So far we have learned a lot about using the python api. While it is possible to build anything you want, most of the time it makes much more sense to resuse something that already exists.

Python comes prepackaged with a lot of libraries that offer common functionality https://docs.python.org/3/library/

Python's extensive library includes everything from mathematical functions to compression functionality.

For this class we shall be looking at the two most commonly used libraries, OS and Math. We shall also take a look at an important library for working with remote resources urllib.

##Step 1

@prodeveloper
prodeveloper / fetching_post.md
Last active March 16, 2017 09:44
Fetching post challenge

In this challenge we will be exercises our skills in:

  1. Using python libraries
  2. Using if constructs
  3. Using for construct
  4. Using methods

The requirement we need delivered is.

As a reader, I want the system to ask me for the post ID that am interestd in and then fetch the post for me.

@prodeveloper
prodeveloper / guessing_game.md
Last active March 23, 2017 09:08
Simple guessing game python

As we end this semester, we will do so with building a small game.

The point of the game is to guess the number that the machine has. You will get feedback in terms of clues on how you are doing, either good or bad.

The requirements are:

    As a gamer I want the script to generate a random number between 1 and 100 which I don't know

    As a gamer I want the script to ask me for my own guess of the number, if am wrong, then I should be given a clue as to weather my guess is too high or too low.