You are on page 1of 19

EL6240

Sains Data & Teknologi Web


Python

Dr.-Ing. Eueung Mulyana


Intro
Dynamic programming language
which supports several different
programing paradigms:

What is ● Procedural programming

Python?
● Object oriented programming
● Functional programming

Python is often described as a


“batteries included” language due
to its comprehensive standard
library.
● Extremely versatile language: Website
development, data analysis, server
maintenance, numerical analysis, ...
● Syntax is clear, easy to read and learn
(almost pseudo code)


Common language
Intuitive object oriented programming Why Python?
● Full modularity, hierarchical packages
● Comprehensive standard library for Graf, Linner, Lischewski @FZJuelich
many tasks
● Big community Python has built-in libraries for nearly
● Simply extendable via C/C++, wrapping everything… and there are third-party
of C/C++ libraries
libraries for everything else (@jvp)
● Focus: Programming speed
For user programs: Python is fast
enough!

Most parts of Python are written in C


Is Python Fast For compute intensive algorithms:

Enough? Fortran, C, C++ might be better

Performance-critical parts can be


re-implemented in C/C++ if
necessary

First analyse, then optimise!


Strong & Dynamic Typing
Strong Typing Dynamic Typing

● Object is of exactly one type! A string is ● No variable declaration


always a string, an integer always an ● Variable names can be assigned to
integer different data types in the course of a
● Counterexamples: PHP, JavaScript, C: char program
can be interpreted as short, void* can be ● An object’s attributes are checked only at
everything run time
● Duck typing (an object is defined by its
methods and attributes)

When I see a bird that walks like a duck


and swims like a duck and quacks like a
duck, I call that bird a duck. (James
Whitcomb Riley)
Documentation
Online help in the interpreter:

● help(): general Python help


● help(obj): help regarding an object, e.g. a function or a module
● dir () : all used names
● dir(obj): all attributes of an object

Official documentation: https://docs.python.org/


Python’s
Scientific Stack

@jakevdp PyCon 2017


Why is Python 1. Interoperability with other
languages
such an 2. “Batteries Included” +
third-party modules
effective tool 3. Simplicity & dynamic nature

[in science]?
4. [Open ethos well-fit to science]
Quotes (@jakevdp)

People want to use So people build


Python because of its Python packages that
intuitiveness, beauty, incorporate lessons
philosophy, and learned in other tools
readability. & communities.
Quotes (@jakevdp)

Python is not a data Python is a


science language. general-purpose
language, and this is
one of its great
How did Python become a strengths for data
data science powerhouse? science.
Showcases
Credit @moskytw Practicing Py3
Syntax Summary
Basics
Variables
Strings

Lists
Tuples
Dictionaries

Conditionals (IF)
User Input

Python Crash Course


Conditionals (WHILE)

Functions
Classes

Files
Exceptions

Python Crash Course


Python Basics &
Intermediate

DS Cheat Sheet

@dataquest
END

You might also like