Friday, April 7, 2017

PYTHON & JUPYTER

Assalammulaikum w.b.t everyone and may all of you in the pink 😃.

This is continuation of last lesson which is Python. So, before we discover more about python and jupyter, we learnt about the data types in python which are number, list, string, tuple and dictionary.

First of all, go to command prompt or cmd.

Second, just type in python. Later, proceed with variable which is the name and do not forget to put open and close quotes "" and hit the button "enter". To see the outcome, type print in the bracket the statement.
The result will become as below.

Next, to make data type for list, one should put the square bracket and with the list. After that, proceed with the print input.

Furthermore, the values stored in a list can be accessed using the slice operator ([] and [:]) with indexes starting at 0 in the beginning of the list and working their way to end -1.


Lastly, to exit the command prompt put exit() 


Next, we learnt about jupyter. We will guide you to use jupyter.
1. First go to https://software-carpentry.org/ 
2. Click LESSON
3. Go to programming with python (site)
4. Click Setup and download python-novice-inflammation-data.zip
5. Back to programming with python and go to Analyzing Patient Data
6. Open jupyter, click upload and upload inflammation-01 from python-novice-inflammation-data.zip folder that you download just now
7.Click New, Python 3 and follow the instruction from analyzing patient data

You will get this as result

To move to next column, you need to press [shift] [enter]

You can continue follow the tutorial provide by analyzing patient data. Here are some example of result that you will get




For tutorial in plotting a graph or shape, you need to go to http://matplotlib.org/gallery.html, and choose the graph or shape you need then type the code on jupyter.

This is example:




You can change your data according to your preferences by changing the code. For example, change green to red so the graph produced will show you red colour instead of green colour.

That's all for today and hope you guys can gain something from this. Thank you.💓

No comments:

Post a Comment