SlideShare a Scribd company logo
1 of 31
Download to read offline
woohoo, progamming!
in python, yay!
Marc Gouw
Virtual what now?
VirtualBox is a program to create and manage Virtual Machines (operating systems)
Great way to create sandboxed environments (to play around)
… lets us mess around with linux
www.virtualbox.org
linux? ubuntu?
Linux is an operating system
… created by Linus Torvals in 1991
… written as Free & Open Source Software
linux? ubuntu?
Linux is an operating system
… created by Linus Torvals in 1991
… written as Free & Open Source Software
http://www.stickycomics.com/computer-update/
… all software is free to install
… very safe and secure
… soooo many options
linux? ubuntu?
Ubuntu is a linux distribution (a.k.a. flavour)
XFCE is a desktop environment (user interface)
xubuntu simple, lightweight & user-friendly linux distro.
linux? ubuntu?
Ubuntu is a linux distribution (a.k.a. flavour)
XFCE is a desktop environment (user interface)
xubuntu simple, lightweight & user-friendly linux distro.
≠ ≠
Python!!!
https://en.wikipedia.org/wiki/Guido_van_Rossum
Created in the 1980’s by Guido van Rossum (the BDFL)
… an easy and intuitive language just as powerful as major competitors
… open source so anyone can contribute to its development
… code that is as understandable as plain English
… suitability for everyday tasks, allowing for short development times
(goals for DARPA funded project “Computer Programming for Everybody”)
Python!!!
https://excelwithbusiness.com/blog/post/web-design/say-hello-world-in-28-different-programming-languages
“Hello world” program in various languages
java C++
python
Python in (neuro)science…
Python is a general purpose programming language
Python is free & open source → lots of “community” modules available
Why not MATLAB, or R???
python 2 vs. python 3
“Python 2.x is legacy, Python 3.x is the present and future of the language.”
… how the print statement works … symbols used for division
… mostly small details
… better library support and older modules in python 2.x
… python 2 (more specifically 2.7) FTW!!!
http://learntocodewith.me/programming/python/python-2-vs-python-3/
The plan!
Basics: types, operations & calculations
Basics: conditionals & iteration
Basics: lists, tuples, dictionaries
Basics: writing functions
Reading & writing files: opening, parsing & formats
Working with numbers: numpy & scipy
Making plots: matplotlib & pylab
… if you guys want more after all of that …
Writing better code: functions, pep8, classes
Working with numbers: Numpy & Scipy (advanced)
Other modules: Pandas & Scikit-learn
Interactive notebooks: ipython & jupyter
Advanced topics: virtual environments & version control
… some arbitrary examples
http://matplotlib.org/gallery.html & http://scikit-learn.org/
Welcome to neuropy@xubuntu!!!
username: neuropy
password: 1234 (for admin stuff)
i’ve installed: only some virtual machine goodies…
Installing software in xubuntu
… via the software center
… let’s install gedit
command line warrior, step 1…
Navigating the linux command line:
… cp source-file destination-file → copy
… cp -r source-folder destination-folder → copy
… mv source destination → move
… ls → list note: “..” means
“up one folder”
… cd folder → change directory
Manipulating files & folders
… rm file → remove
… rm -r folder → copy
… cat file → show contents
some other random commands…
… head file → cat first 20 lines
… tail file → cat last 20 lines
command line pythonista, step 1…
Writing helloworld.py
… open gedit, let’s write a simple “Hello world” program.
---- file contents ----
print “Hello world”
… save it somewhere (let’s say, the desktop)
To run the file:
… python helloword.py
command line pythonista, step 1…
Writing helloworld.py
… open gedit, let’s write a simple “Hello world” program.
---- file contents ----
print “Hello world”
… save it somewhere (let’s say, the desktop)
To run the file:
… python helloword.py
error messages are your friends!!!
(you’ll be seeing a lot of them!)
interactive python
let’s fire up an interactive shell:
… in the command line, type “python” (and hit enter)
… each command is interpreted on the fly!
… >>> print “Hello python!”
“Hello python!”
>>>$
pythonlinux
interactive python: a calculator
basic maths with python: integers
>>> 1 + 2 * 3
7
>>> a = 5
>>> b = 10
>>> c = a * b
>>> print c
50
>>> a + b
15
interactive python: a calculator
basic maths with python: integers
>>> 1 + 2 * 3
7
>>> a = 5
>>> b = 10
>>> c = a * b
>>> print c
50
>>> a + b
15
more maths with python: floats
>>> d = 1.2 + 1.3
>>> print d
2.5
interactive python: a calculator
basic maths with python: integers
>>> 1 + 2 * 3
7
>>> a = 5
>>> b = 10
>>> c = a * b
>>> print c
50
>>> a + b
15
more maths with python: floats
>>> d = 1.2 + 1.3
>>> print d
2.5
more maths with python…
>>> 4 ** 3
64
>>> 5 / 2
interactive python: a calculator
basic maths with python: integers
>>> 1 + 2 * 3
7
>>> a = 5
>>> b = 10
>>> c = a * b
>>> print c
50
>>> a + b
15
more maths with python: floats
>>> d = 1.2 + 1.3...
>>> print d
2.5
more maths with python…
>>> 4 ** 3
64
>>> 5 / 2
2
interactive python: a calculator
basic maths with python: integers
>>> 1 + 2 * 3
7
>>> a = 5
>>> b = 10
>>> c = a * b
>>> print c
50
>>> a + b
15
more maths with python: floats
>>> d = 1.2 + 1.3...
>>> print d
2.5
more maths with python…
>>> 4 ** 3
64
>>> 5 / 2
2 WTF?!?
interactive python: a calculator
basic maths with python: integers
>>> 1 + 2 * 3
7
>>> a = 5
>>> b = 10
>>> c = a * b
>>> print c
50
>>> a + b
15
more maths with python: floats
>>> d = 1.2 + 1.3...
>>> print d
2.5
more maths with python…
>>> 4 ** 3
64
>>> 5 / 2
2 WTF?!?
>>> 5.0 / 2.0
2.5
python 2 vs. python 3
… in python 2: “/” does int or float
division.
… fixed in python 3: “/” always does
“normal” division
interactive python: a calculator
basic maths with python: integers
>>> 1 + 2 * 3
7
>>> a = 5
>>> b = 10
>>> c = a * b
>>> print c
50
>>> a + b
15
more maths with python: floats
>>> d = 1.2 + 1.3...
>>> print d
2.5
more maths with python…
>>> 4 ** 3
64
>>> 5 / 2
2 WTF?!?
>>> 5.0 / 2.0
2.5
myfirstprogram.py
lets start a new file myfirstprogram.py
---- file contents ----
from __future__ import division
# the first line fixes the “division” problem in python 2
# this is a comment. Comments start with “#”, and are not interpreted!
name = “Marc” # comments can also go after stuff
print “Hello”, name # print multiple things in one line with “,”
a = 20
b = 15
c = a * b
print “Some numbers:”, a, b, c
print “Let’s make sure division is working OK”
print a, “divided by”, b, “=”, a / b
userintercation.py
lets start a new file userinteraction.py
also, let’s see the difference between integers and strings
---- file contents ----
from __future__ import division
# raw_input asks the user for input
name = raw_input(“What is your name?”)
print “Hello”, name
# we need to convert numbers to int (or float) to do maths
a = int(raw_input(“Write a number, any number:”))
b = int(raw_input(“Gimme another one:”))
print a, “plus”, b, “=”, a + b
print “I can do addition!”
take home to christmas messages:
the linux command line:
… ls, cd, cp, mv & rm
… also cat, head & tail
two ways to use python:
… from a file: python filename.py
… interactively: python (enter) → “>>>”
basic math operators:
… +, -, *, / and **
… remember python 2 is strange with “/”
… just use “from __future__ import division” and you’ll be fine!
asking for user input (and converting strings to integers)
… name = raw_input(“And, are we liking python yet?”)
Class 1: Welcome to programming

More Related Content

What's hot

Using the Power to Prove
Using the Power to ProveUsing the Power to Prove
Using the Power to ProveKazuho Oku
 
Go, the one language to learn in 2014
Go, the one language to learn in 2014Go, the one language to learn in 2014
Go, the one language to learn in 2014Andrzej Grzesik
 
System call (Fork +Exec)
System call (Fork +Exec)System call (Fork +Exec)
System call (Fork +Exec)Amit Ghosh
 
AmI 2017 - Python intermediate
AmI 2017 - Python intermediateAmI 2017 - Python intermediate
AmI 2017 - Python intermediateLuigi De Russis
 
The challenges of file formats
The challenges of file formatsThe challenges of file formats
The challenges of file formatsAnge Albertini
 
How to download and install Python - lesson 2
How to download and install Python - lesson 2How to download and install Python - lesson 2
How to download and install Python - lesson 2Shohel Rana
 
Introduction to python 3 2nd round
Introduction to python 3   2nd roundIntroduction to python 3   2nd round
Introduction to python 3 2nd roundYouhei Sakurai
 
Best Python Online Training with Live Project by Expert
Best Python Online Training with Live Project by Expert Best Python Online Training with Live Project by Expert
Best Python Online Training with Live Project by Expert QA TrainingHub
 
Assignment unix & shell programming
Assignment  unix  & shell programmingAssignment  unix  & shell programming
Assignment unix & shell programmingMohit Aggarwal
 
Better Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx ExtensionsBetter Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx Extensionsdoughellmann
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3Youhei Sakurai
 
Python教程 / Python tutorial
Python教程 / Python tutorialPython教程 / Python tutorial
Python教程 / Python tutorialee0703
 
AmI 2016 - Python basics
AmI 2016 - Python basicsAmI 2016 - Python basics
AmI 2016 - Python basicsLuigi De Russis
 

What's hot (19)

Python Tutorial
Python TutorialPython Tutorial
Python Tutorial
 
Python basic
Python basicPython basic
Python basic
 
Using the Power to Prove
Using the Power to ProveUsing the Power to Prove
Using the Power to Prove
 
Go, the one language to learn in 2014
Go, the one language to learn in 2014Go, the one language to learn in 2014
Go, the one language to learn in 2014
 
System call (Fork +Exec)
System call (Fork +Exec)System call (Fork +Exec)
System call (Fork +Exec)
 
AmI 2017 - Python intermediate
AmI 2017 - Python intermediateAmI 2017 - Python intermediate
AmI 2017 - Python intermediate
 
The challenges of file formats
The challenges of file formatsThe challenges of file formats
The challenges of file formats
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python Workshop
Python WorkshopPython Workshop
Python Workshop
 
How to download and install Python - lesson 2
How to download and install Python - lesson 2How to download and install Python - lesson 2
How to download and install Python - lesson 2
 
Introduction to python 3 2nd round
Introduction to python 3   2nd roundIntroduction to python 3   2nd round
Introduction to python 3 2nd round
 
Best Python Online Training with Live Project by Expert
Best Python Online Training with Live Project by Expert Best Python Online Training with Live Project by Expert
Best Python Online Training with Live Project by Expert
 
Assignment unix & shell programming
Assignment  unix  & shell programmingAssignment  unix  & shell programming
Assignment unix & shell programming
 
Better Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx ExtensionsBetter Documentation Through Automation: Creating docutils & Sphinx Extensions
Better Documentation Through Automation: Creating docutils & Sphinx Extensions
 
Introduction to python 3
Introduction to python 3Introduction to python 3
Introduction to python 3
 
2 × 3 = 6
2 × 3 = 62 × 3 = 6
2 × 3 = 6
 
Python教程 / Python tutorial
Python教程 / Python tutorialPython教程 / Python tutorial
Python教程 / Python tutorial
 
HackIM 2012 CTF Walkthrough
HackIM 2012 CTF WalkthroughHackIM 2012 CTF Walkthrough
HackIM 2012 CTF Walkthrough
 
AmI 2016 - Python basics
AmI 2016 - Python basicsAmI 2016 - Python basics
AmI 2016 - Python basics
 

Viewers also liked

w3schools%20javascript%20comments
w3schools%20javascript%20commentsw3schools%20javascript%20comments
w3schools%20javascript%20commentstutorialsruby
 
Classes and objects till 16 aug
Classes and objects till 16 augClasses and objects till 16 aug
Classes and objects till 16 augshashank12march
 
Loops Basics
Loops BasicsLoops Basics
Loops BasicsMushiii
 
Intro to C++ Basic
Intro to C++ BasicIntro to C++ Basic
Intro to C++ BasicShih Chi Lin
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programAAKASH KUMAR
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ programmatiur rahman
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language Mohamed Loey
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointJavaTpoint.Com
 
Variables And Measurement Scales
Variables And Measurement ScalesVariables And Measurement Scales
Variables And Measurement Scalesguesta861fa
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteachingeteaching
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 

Viewers also liked (18)

Lab 1
Lab 1Lab 1
Lab 1
 
Basic of c &c++
Basic of c &c++Basic of c &c++
Basic of c &c++
 
w3schools%20javascript%20comments
w3schools%20javascript%20commentsw3schools%20javascript%20comments
w3schools%20javascript%20comments
 
01 basic programming in c++
01 basic programming in c++01 basic programming in c++
01 basic programming in c++
 
Classes and objects till 16 aug
Classes and objects till 16 augClasses and objects till 16 aug
Classes and objects till 16 aug
 
Loops Basics
Loops BasicsLoops Basics
Loops Basics
 
Intro to C++ Basic
Intro to C++ BasicIntro to C++ Basic
Intro to C++ Basic
 
Loops c++
Loops c++Loops c++
Loops c++
 
Basic concept of c++
Basic concept of c++Basic concept of c++
Basic concept of c++
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ program
 
Basic structure of C++ program
Basic structure of C++ programBasic structure of C++ program
Basic structure of C++ program
 
Loops in C
Loops in CLoops in C
Loops in C
 
C++ Programming Language
C++ Programming Language C++ Programming Language
C++ Programming Language
 
C Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpointC Programming Language Tutorial for beginners - JavaTpoint
C Programming Language Tutorial for beginners - JavaTpoint
 
Variables And Measurement Scales
Variables And Measurement ScalesVariables And Measurement Scales
Variables And Measurement Scales
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
 
Basic variables ppt
Basic variables pptBasic variables ppt
Basic variables ppt
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 

Similar to Class 1: Welcome to programming

python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdfgmadhu8
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPTShivam Gupta
 
Learn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersLearn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersKingsleyAmankwa
 
Python in 30 minutes!
Python in 30 minutes!Python in 30 minutes!
Python in 30 minutes!Fariz Darari
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...DRVaibhavmeshram1
 
Python intro
Python introPython intro
Python introrik0
 
Python Course Basic
Python Course BasicPython Course Basic
Python Course BasicNaiyan Noor
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonmckennadglyn
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughgabriellekuruvilla
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-introIshaq Ali
 

Similar to Class 1: Welcome to programming (20)

python-160403194316.pdf
python-160403194316.pdfpython-160403194316.pdf
python-160403194316.pdf
 
Python
PythonPython
Python
 
Python Seminar PPT
Python Seminar PPTPython Seminar PPT
Python Seminar PPT
 
python into.pptx
python into.pptxpython into.pptx
python into.pptx
 
Learn Python 3 for absolute beginners
Learn Python 3 for absolute beginnersLearn Python 3 for absolute beginners
Learn Python 3 for absolute beginners
 
Python in 30 minutes!
Python in 30 minutes!Python in 30 minutes!
Python in 30 minutes!
 
05 python.pdf
05 python.pdf05 python.pdf
05 python.pdf
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
Python avinash
Python avinashPython avinash
Python avinash
 
Python intro
Python introPython intro
Python intro
 
Python Course Basic
Python Course BasicPython Course Basic
Python Course Basic
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
py4inf-01-intro.ppt
py4inf-01-intro.pptpy4inf-01-intro.ppt
py4inf-01-intro.ppt
 
Python and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthroughPython and Pytorch tutorial and walkthrough
Python and Pytorch tutorial and walkthrough
 
Python
PythonPython
Python
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-intro
 
Charming python
Charming pythonCharming python
Charming python
 
Python Course
Python CoursePython Course
Python Course
 

More from Marc Gouw

Class 7b: Files & File I/O
Class 7b: Files & File I/OClass 7b: Files & File I/O
Class 7b: Files & File I/OMarc Gouw
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2Marc Gouw
 
Class 4: For and while
Class 4: For and whileClass 4: For and while
Class 4: For and whileMarc Gouw
 
Class 6: Lists & dictionaries
Class 6: Lists & dictionariesClass 6: Lists & dictionaries
Class 6: Lists & dictionariesMarc Gouw
 
Class 8b: Numpy & Matplotlib
Class 8b: Numpy & MatplotlibClass 8b: Numpy & Matplotlib
Class 8b: Numpy & MatplotlibMarc Gouw
 
Class 7a: Functions
Class 7a: FunctionsClass 7a: Functions
Class 7a: FunctionsMarc Gouw
 
Class 8a: Modules and imports
Class 8a: Modules and importsClass 8a: Modules and imports
Class 8a: Modules and importsMarc Gouw
 
Class 5: If, while & lists
Class 5: If, while & listsClass 5: If, while & lists
Class 5: If, while & listsMarc Gouw
 
Class 3: if/else
Class 3: if/elseClass 3: if/else
Class 3: if/elseMarc Gouw
 

More from Marc Gouw (9)

Class 7b: Files & File I/O
Class 7b: Files & File I/OClass 7b: Files & File I/O
Class 7b: Files & File I/O
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2
 
Class 4: For and while
Class 4: For and whileClass 4: For and while
Class 4: For and while
 
Class 6: Lists & dictionaries
Class 6: Lists & dictionariesClass 6: Lists & dictionaries
Class 6: Lists & dictionaries
 
Class 8b: Numpy & Matplotlib
Class 8b: Numpy & MatplotlibClass 8b: Numpy & Matplotlib
Class 8b: Numpy & Matplotlib
 
Class 7a: Functions
Class 7a: FunctionsClass 7a: Functions
Class 7a: Functions
 
Class 8a: Modules and imports
Class 8a: Modules and importsClass 8a: Modules and imports
Class 8a: Modules and imports
 
Class 5: If, while & lists
Class 5: If, while & listsClass 5: If, while & lists
Class 5: If, while & lists
 
Class 3: if/else
Class 3: if/elseClass 3: if/else
Class 3: if/else
 

Recently uploaded

CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡anilsa9823
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Patrick Diehl
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxAleenaTreesaSaji
 
Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)DHURKADEVIBASKAR
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxAArockiyaNisha
 
Work, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE PhysicsWork, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE Physicsvishikhakeshava1
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsSérgio Sacani
 
Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxAleenaTreesaSaji
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett SquareIsiahStephanRadaza
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzohaibmir069
 
Genomic DNA And Complementary DNA Libraries construction.
Genomic DNA And Complementary DNA Libraries construction.Genomic DNA And Complementary DNA Libraries construction.
Genomic DNA And Complementary DNA Libraries construction.k64182334
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...anilsa9823
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTSérgio Sacani
 
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxAnalytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxSwapnil Therkar
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Nistarini College, Purulia (W.B) India
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​kaibalyasahoo82800
 

Recently uploaded (20)

CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?
 
GFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptxGFP in rDNA Technology (Biotechnology).pptx
GFP in rDNA Technology (Biotechnology).pptx
 
Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)Recombinant DNA technology( Transgenic plant and animal)
Recombinant DNA technology( Transgenic plant and animal)
 
The Philosophy of Science
The Philosophy of ScienceThe Philosophy of Science
The Philosophy of Science
 
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 
Work, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE PhysicsWork, Energy and Power for class 10 ICSE Physics
Work, Energy and Power for class 10 ICSE Physics
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Luciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptxLuciferase in rDNA technology (biotechnology).pptx
Luciferase in rDNA technology (biotechnology).pptx
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett Square
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistan
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
Genomic DNA And Complementary DNA Libraries construction.
Genomic DNA And Complementary DNA Libraries construction.Genomic DNA And Complementary DNA Libraries construction.
Genomic DNA And Complementary DNA Libraries construction.
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
 
Disentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOSTDisentangling the origin of chemical differences using GHOST
Disentangling the origin of chemical differences using GHOST
 
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxAnalytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...
 
Nanoparticles synthesis and characterization​ ​
Nanoparticles synthesis and characterization​  ​Nanoparticles synthesis and characterization​  ​
Nanoparticles synthesis and characterization​ ​
 

Class 1: Welcome to programming

  • 2. Virtual what now? VirtualBox is a program to create and manage Virtual Machines (operating systems) Great way to create sandboxed environments (to play around) … lets us mess around with linux www.virtualbox.org
  • 3. linux? ubuntu? Linux is an operating system … created by Linus Torvals in 1991 … written as Free & Open Source Software
  • 4. linux? ubuntu? Linux is an operating system … created by Linus Torvals in 1991 … written as Free & Open Source Software http://www.stickycomics.com/computer-update/ … all software is free to install … very safe and secure … soooo many options
  • 5. linux? ubuntu? Ubuntu is a linux distribution (a.k.a. flavour) XFCE is a desktop environment (user interface) xubuntu simple, lightweight & user-friendly linux distro.
  • 6. linux? ubuntu? Ubuntu is a linux distribution (a.k.a. flavour) XFCE is a desktop environment (user interface) xubuntu simple, lightweight & user-friendly linux distro. ≠ ≠
  • 7. Python!!! https://en.wikipedia.org/wiki/Guido_van_Rossum Created in the 1980’s by Guido van Rossum (the BDFL) … an easy and intuitive language just as powerful as major competitors … open source so anyone can contribute to its development … code that is as understandable as plain English … suitability for everyday tasks, allowing for short development times (goals for DARPA funded project “Computer Programming for Everybody”)
  • 9. Python in (neuro)science… Python is a general purpose programming language Python is free & open source → lots of “community” modules available Why not MATLAB, or R???
  • 10. python 2 vs. python 3 “Python 2.x is legacy, Python 3.x is the present and future of the language.” … how the print statement works … symbols used for division … mostly small details … better library support and older modules in python 2.x … python 2 (more specifically 2.7) FTW!!! http://learntocodewith.me/programming/python/python-2-vs-python-3/
  • 11.
  • 12. The plan! Basics: types, operations & calculations Basics: conditionals & iteration Basics: lists, tuples, dictionaries Basics: writing functions Reading & writing files: opening, parsing & formats Working with numbers: numpy & scipy Making plots: matplotlib & pylab … if you guys want more after all of that … Writing better code: functions, pep8, classes Working with numbers: Numpy & Scipy (advanced) Other modules: Pandas & Scikit-learn Interactive notebooks: ipython & jupyter Advanced topics: virtual environments & version control
  • 13. … some arbitrary examples http://matplotlib.org/gallery.html & http://scikit-learn.org/
  • 14.
  • 15. Welcome to neuropy@xubuntu!!! username: neuropy password: 1234 (for admin stuff) i’ve installed: only some virtual machine goodies… Installing software in xubuntu … via the software center … let’s install gedit
  • 16. command line warrior, step 1… Navigating the linux command line: … cp source-file destination-file → copy … cp -r source-folder destination-folder → copy … mv source destination → move … ls → list note: “..” means “up one folder” … cd folder → change directory Manipulating files & folders … rm file → remove … rm -r folder → copy … cat file → show contents some other random commands… … head file → cat first 20 lines … tail file → cat last 20 lines
  • 17. command line pythonista, step 1… Writing helloworld.py … open gedit, let’s write a simple “Hello world” program. ---- file contents ---- print “Hello world” … save it somewhere (let’s say, the desktop) To run the file: … python helloword.py
  • 18. command line pythonista, step 1… Writing helloworld.py … open gedit, let’s write a simple “Hello world” program. ---- file contents ---- print “Hello world” … save it somewhere (let’s say, the desktop) To run the file: … python helloword.py error messages are your friends!!! (you’ll be seeing a lot of them!)
  • 19. interactive python let’s fire up an interactive shell: … in the command line, type “python” (and hit enter) … each command is interpreted on the fly! … >>> print “Hello python!” “Hello python!” >>>$ pythonlinux
  • 20. interactive python: a calculator basic maths with python: integers >>> 1 + 2 * 3 7 >>> a = 5 >>> b = 10 >>> c = a * b >>> print c 50 >>> a + b 15
  • 21. interactive python: a calculator basic maths with python: integers >>> 1 + 2 * 3 7 >>> a = 5 >>> b = 10 >>> c = a * b >>> print c 50 >>> a + b 15 more maths with python: floats >>> d = 1.2 + 1.3 >>> print d 2.5
  • 22. interactive python: a calculator basic maths with python: integers >>> 1 + 2 * 3 7 >>> a = 5 >>> b = 10 >>> c = a * b >>> print c 50 >>> a + b 15 more maths with python: floats >>> d = 1.2 + 1.3 >>> print d 2.5 more maths with python… >>> 4 ** 3 64 >>> 5 / 2
  • 23. interactive python: a calculator basic maths with python: integers >>> 1 + 2 * 3 7 >>> a = 5 >>> b = 10 >>> c = a * b >>> print c 50 >>> a + b 15 more maths with python: floats >>> d = 1.2 + 1.3... >>> print d 2.5 more maths with python… >>> 4 ** 3 64 >>> 5 / 2 2
  • 24. interactive python: a calculator basic maths with python: integers >>> 1 + 2 * 3 7 >>> a = 5 >>> b = 10 >>> c = a * b >>> print c 50 >>> a + b 15 more maths with python: floats >>> d = 1.2 + 1.3... >>> print d 2.5 more maths with python… >>> 4 ** 3 64 >>> 5 / 2 2 WTF?!?
  • 25. interactive python: a calculator basic maths with python: integers >>> 1 + 2 * 3 7 >>> a = 5 >>> b = 10 >>> c = a * b >>> print c 50 >>> a + b 15 more maths with python: floats >>> d = 1.2 + 1.3... >>> print d 2.5 more maths with python… >>> 4 ** 3 64 >>> 5 / 2 2 WTF?!? >>> 5.0 / 2.0 2.5 python 2 vs. python 3 … in python 2: “/” does int or float division. … fixed in python 3: “/” always does “normal” division
  • 26. interactive python: a calculator basic maths with python: integers >>> 1 + 2 * 3 7 >>> a = 5 >>> b = 10 >>> c = a * b >>> print c 50 >>> a + b 15 more maths with python: floats >>> d = 1.2 + 1.3... >>> print d 2.5 more maths with python… >>> 4 ** 3 64 >>> 5 / 2 2 WTF?!? >>> 5.0 / 2.0 2.5
  • 27. myfirstprogram.py lets start a new file myfirstprogram.py ---- file contents ---- from __future__ import division # the first line fixes the “division” problem in python 2 # this is a comment. Comments start with “#”, and are not interpreted! name = “Marc” # comments can also go after stuff print “Hello”, name # print multiple things in one line with “,” a = 20 b = 15 c = a * b print “Some numbers:”, a, b, c print “Let’s make sure division is working OK” print a, “divided by”, b, “=”, a / b
  • 28. userintercation.py lets start a new file userinteraction.py also, let’s see the difference between integers and strings ---- file contents ---- from __future__ import division # raw_input asks the user for input name = raw_input(“What is your name?”) print “Hello”, name # we need to convert numbers to int (or float) to do maths a = int(raw_input(“Write a number, any number:”)) b = int(raw_input(“Gimme another one:”)) print a, “plus”, b, “=”, a + b print “I can do addition!”
  • 29.
  • 30. take home to christmas messages: the linux command line: … ls, cd, cp, mv & rm … also cat, head & tail two ways to use python: … from a file: python filename.py … interactively: python (enter) → “>>>” basic math operators: … +, -, *, / and ** … remember python 2 is strange with “/” … just use “from __future__ import division” and you’ll be fine! asking for user input (and converting strings to integers) … name = raw_input(“And, are we liking python yet?”)