0% found this document useful (0 votes)
34 views35 pages

1-1 Introduction

Uploaded by

kurnia gusti ayu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views35 pages

1-1 Introduction

Uploaded by

kurnia gusti ayu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

About Instructor

Name : Dr Vivi Andasari, ST, MSc, PDEng

Educa9on : ST à Electrical Engineering, Univ. of Indonesia 🇮🇩


MSc à Engineering Mathema9cs, Chalmers
University of Technology, Sweden 🇸🇪
PDEng à Mathema9cal Physics, Eindhoven University
of Technology, the Netherlands 🇳🇱
PhD à Mathema9cs, Univ. of Dundee, Scotland 🇬🇧

Teaching : All Mathema9cs: University of Dundee


Modeling & Numerical Methods: Boston University
Data Science, Calculus, Linear Algebra: UI
Ar9ficial Intelligence: UI & Kominfo
Syllabus
Day Session Topics
1 1 Introduction; Installation; Python data structures
1 2 Python built-in functions & modules; Basic operations
1 3 Functions & Functional Programming

2 1 Scientific computing with NumPy, SciPy


2 2 Data visualization with Matplotlib
2 3 Data visualization with Seaborn

3 1 Object Oriented Programming (OOP)


3 2 Jupyter Notebook
3 3 Teaching tools with Jupyter Notebook
Categories of Programming Languages
In general, programming languages can be categorized into two
different levels:
§ Low-level language, includes machine code and assembly
languages.
Ø A machine language or machine code is a language that is
used to directly control a computer’s central processing
unit (CPU). A machine language program is made up of a
series of binary patterns (e.g., 01011100).
Ø An assembly language is used to write code at the
processor level, which is specific to a processor
architecture. The assembly code is written using
mnemonics, abbreviated text commands. Examples:
SOAP (Symbolic Optimal Assembly Program), the Turbo
Pascal compiler, Lotus 1-2-3, etc.
Categories of Programming Languages
§ High-level language, is a programming language that:
Ø enables a programmer to write programs (or source cod)
that are independent of a particular type of computer
(hardware),
Ø is closer to human languages and further from machine
languages, hence considered high-level.
Ø use the common English language to help make the code
more understandable and to speedup the process of
writing and debugging programs.
Ø is translated using either a compiler or an interpreter,
Ø Examples: Python, Visual Basic, Java, C, C++, SQL,
Delphi, Perl, PHP, Ruby, C#, etc.
Hierarchy of Programming

High-level
programming

Low-level
programming
Features of High-Level Languages
A few features that are possessed by high-level languages which are
not available in low-level languages:
ü Selection and iteration constructs, such as IF… THEN…
ELSE…, FOR… ENDFOR, WHILE… ENDWHILE.
ü Boolean operators such as AND, OR, and NOT to construct
complex conditional statements.
ü Identifiers using an unlimited number of alphabetic and
numeric characters and some special characters to allow
variable names to be made meaningful and sensible.
ü Data structures such as arrays, lists, tuples, and dictionaries
(records).
ü High-level languages are relatively easy to learn and much
faster to program in.
Program Translators
High-level languages (and assembler languages) need to be translated
into machine code for a computer system to understand it.
There are three types of translators that will do the translation:
(1) Assemblers ➤ to translate assembly language into machine code.
(2) Compilers ➤ to convert high-level programming language to
low-level programming language; compilers translate all the
source code at the same time to create the compiled code, or
machine code, also known as the object code.
(3) Interpreters ➤ they are similar to compilers, are used to convert
high-level programming language to low-level programming
language. The difference between a compiler and an interpreter is
that the interpreter converts the program one line of code at a
time and reports errors when detected, while also doing the
conversion.
Compiled & Interpreted Languages
A compiled language is a programming language which are
generally compiled and not interpreted. It is one where the source
code, once compiled, is expressed in the instructions of the target
machine; this machine code is undecipherable by humans. Examples
of compiled language are Ada, Algol, Visual Basic, PureBasic, C,
C++, C#, D, Java, COBOL, Cobra, Crystal, Eiffel, Erlang, Fortran,
Julia, Go, Haskell, Pascal, etc.

An interpreted language is a programming language which are


generally interpreted, without compiling a source code into machine
instructions. It is one where the instructions are not directly executed
by the target machine, but instead read and executed by some other
program. Examples of interpreted language are Python, JavaScript,
Matlab, Ruby, BASIC, Perl, PHP, Lisp, R
Type System
All programming languages include some kind of type system that
formalizes which categories of objects it can work with and how
those categories are treated.

Dynamic Typing ➢ Python is a dynamically typed language. This


means that the Python interpreter does type checking only as code
runs, and the type of a variable is allowed to change over its lifetime.

Static Typing ➢ The opposite of dynamic typing is static typing.


Static type checks are performed without running the program. In
most statically typed languages, for instance C and Java, this is done
as your program is compiled. The type of a variable is not allowed to
change over its lifetime.
Type System
# Python examples (Dynamic Typing):
>>> myNumber = 42
>>> name = “Bentoo Penguin”
>>> PI = 3.141592

// C examples (Static Typing)


int myNumber = 42;
string name[] = “Bentoo Penguin”;
double PI = 3.141592;
New!!! Python Type Hints
Starting Python 3.5, a new feature was introduced for type hinting,
which is like the static typing.

The type hinting feature allows us to specify the expected type of a


variable, function parameter, or return value.

Without type hint:


>>> myNumber = 42

With type hint:


>>> myNumber : int = 42
About Python
§ Python is an interpreted, high-level,
general-purpose programming language.
§ Python uses dynamic typing and a combination
of reference counting and a cycle-detecting garbage collector for
memory management.
§ Python supports multiple programming paradigms, including:
(i) structured (particularly procedural) programming,
(ii) object-oriented programming, and
(iii) functional programming.
§ Python was developed by Guido van Rossum beginning in the late
1980s and was first released in 1991 as Python 0.9.0.
§ Python consistently ranks as one of the most popular programming
languages.
About Python
Python was named after the BBC TV show called
“Monty Python’s Flying Circus”, a comedy
Series from the 1970s.

When he began implementing Python, Guido van Rossum was also


reading the published scripts from Monty Python’s Flying Circus.
Van Rossum thought he needed a name that was short, unique, and
slightly mysterious, so he decided to call the language Python.

Since Monty Python is considered one of the two fundamental


nutrients to a programmer (the other being pizza), Python's creator
named the language in honor of the TV show.
In 2019
About Python
Popular Programming Languages
Data Science Programming Languages
What Makes Python Special?
• It’s easy to learn – the time needed to learn Python is shorter than
for many other languages; this means that it’s possible to start the
actual programming faster.
• It’s easy to teach – the teaching workload is smaller than that
needed by other languages.
• It’s easy to use for writing new software – it’s often possible to
write code faster when using Python.
• It’s easy to understand – it’s also often easier to understand
someone else’s code faster if it is written in Python.
• It’s easy to obtain, install, and deploy. Python is free, open, and
multiplatform, not all languages can boast that.
Nothing is Perfect 😑
Of course, Python has drawbacks too:
• it's not a speed demon – Python does not deliver exceptional
performance;
• in some cases it may be resistant to some simpler testing
techniques – this may mean that debugging Python's code can be
more difficult than with other languages; fortunately, making
mistakes is always harder in Python.
Python Interpreters
Xx

C#

https://data-flair.training/blogs/python-compilers/
Python 2 vs. Python 3
There are two main kinds of Python:
- Python 2
- Python 3

Python 2 is an older version of the original Python. Its development


has since been intentionally stalled. The language will not be
modified in any significant way.

Python 3 is the newer (to be precise, the current) version of the


language. It's going through its own evolution path, creating its own
standards and habits. The latest version is 3.12 and to view all
versions of Python 3:
https://www.python.org/doc/versions/
Where do We Obtain Python Installer?
1. https://www.python.org/
Where do We Obtain Python Installer?
2. https://docs.conda.io/projects/miniconda/en/latest/
Python IDEs
To write Python programs (or code) in a file you need an editor to
type in the code that is designed for writing in the Python language.

An editor that is specifically designed for writing code is called an


IDE or Integrated Development Environment.

There are many Python IDEs available freely on the internet for all
operating systems. Some of free Python IDEs that I recommend for
beginners:
(1) Spyder (https://www.spyder-ide.org)
(2) Thonny (https://thonny.org)
(3) Visual Studio Code (https://code.visualstudio.com)
(4) For advanced users: Sublime Text (https://www.sublimetext.com)
Python Libraries/Packages
What is a Python library?
➡ A library is a collection of code that makes everyday tasks
more efficient.

Major Python libraries for data science & numerical computing:


Python Libraries/Packages
Major Python libraries for data visualization:
pypi
https://pypi.org
Anaconda Dashboard
https://anaconda.org/
Why We Need to Learn Programming
End
References
[1] https://en.wikipedia.org/wiki/Compiled_language
[2] https://en.wikipedia.org/wiki/Interpreted_language
[3] https://thebittheories.com/levels-of-programming-languages-
b6a38a68c0f2
[4] https://cs.lmu.edu/~ray/notes/pltypes/
[5] https://en.wikipedia.org/wiki/High-level_programming_language
[6]
https://bournetocode.com/projects/GCSE_Computing_Fundamentals/
pages/3-2-9-class_prog_langs.html
[7] https://www.geeksforgeeks.org/difference-between-compiled-
and-interpreted-language/
[8] https://realpython.com/lessons/dynamic-vs-static/

You might also like