Workshop: Introduction to programming (with Python)

From Design and Build Lab
Revision as of 20:31, 8 May 2019 by Kristof (talk | contribs) (Kristof moved page Introduction to programming (with Python) to Workshop: Introduction to programming (with Python): retitle for better organization)
Jump to navigation Jump to search

Welcome to Introduction to Programming!!

The first step is to download Python-

If you haven’t yet got python, the latest official installation packages can be found here: http://python.org/download/ Python 3 is preferable, being the newest version out!

The second step is to understand the different things we can do with it!

Ok, so python is this thing called a programming language. It takes text that you’ve written (usually referred to as code), turns it into instructions for your computer, and runs those instructions. We’ll be learning how to write code to do cool and useful stuff. No longer will you be bound to use others’ programs to do things with your computer - you can make your own!

We can use Python as a calculator, very advanced calculator, build softwares, games, and analyze data!

We will start with the most simple concept- variable!

We name a variable and stick to it a number, a word, a list etc. This way we can call it in the future. example for a variable is a=6.

If we want to print the variable we can do - print(a) and we will get 6.

In addition we can use python as a calculator- just type 6+6 and run it and you will get 12.


Types of inputs are integers, floats, string, and list (those are the basic ones that we will use)-

integer is a whole number-> int(), 6, 7

float is not a whole number-> 6.25, 7.3333

string is a word or a phrase- the written part of something-> 'My name is', '6', (we use the tags to help Python recognize it).

list is a list of integers, floats or strings-> [1,2,3,4,5], ['1','2','3','4','5']


Now that we are a bit more familiar lets see how we can use Python to solve Problems!!!

We will go to project Euler- https://projecteuler.net or http://rosalind.info/problems/locations/

The first one is more of solving math problems with Python (or any other software) and the latter is solving real life Bioinformatics problems!!

lets do together the first problem of Project Euler!


Another great source you can use in order to learn the basics of Python is-https://thepythonguru.com. This website provides pictures and explanations on the different structures we have in Python. You can also find there some more advanced programing tutorials.