IKL201 01 Instalasi Anaconda Python
IKL201 01 Instalasi Anaconda Python
IKL201 01 Instalasi Anaconda Python
PEMROGRAMAN IKL201
Pertemuan ke-1
Rencana Perkuliahan
• Penjelasan RPS
• Penjelasan aturan perkuliahan
• Penjelasan Silabus mata kuliah Algoritma dan Pemrograman
• Pendahuluan: Algoritma, Psodocode, Flowchart, interpreter vs compiler, python
Administratif
• Online Classes
• LMS Trisakti
• Google Classroom Trisakti
• Co-requisite dengan Computational Thinking IUC6201
• Kehadiran
• BPP 1 SKS = . . .
• Kalikan 3 SKS (IKL6309)
• Bagi 16
INSTALASI ANACONDA
PYTHON
https://docs.conda.io/projects/miniconda/en/latest/
YOUR FIRST PROGRAM
What the following code do?
print("Hallo, selamat datang")
What the following code do?
temp = int( input("Masukkan suhu: ") )
print("Terima kasih")
EXERCISE
Exercise
• Buat program Python yang mencetak nama sebanyak 5 kali
About Python
• Development started in the 1980’s by Guido van Rossum.
• Only became popular in the last decade or so.
• Python 2.x currently dominates, but Python 3.x is the future of Python.
• Interpreted, very-high-level programming language.
• Supports a multitude of programming paradigms.
• OOP, functional, procedural, logic, structured, etc.
• General purpose.
• Very comprehensive standard library includes numeric modules, crypto services, OS
interfaces, networking modules, GUI support, development tools, etc.
Notable Features
• Easy to learn.
• Supports quick development.
• Cross-platform.
• Open Source.
• Extensible.
• Embeddable.
• Large standard library and active community.
• Useful for a wide variety of applications.
Getting Started
• Choose and install an editor.
• For Linux, I prefer SublimeText.
• Windows users will likely use Idle by default.
• Options include vim, emacs, Notepad++, PyCharm, Eclipse, etc.
Throughout this course, I will be using SublimeText in an Ubuntu environment for all
of the demos.
PRAKTIKUM
Modul 1: Pengenalan Anaconda Python
Interpreter dan Compiler
• Interpreter menerjemahkan Bahasa pemrograman tingkat tinggi (source code in
high level language) ke dalam Bahasa mesin yang dipahami oleh CPU, baris per
baris.
• Setiap kali program dijalankan, source code harus dibaca kembali dari awal oleh
Interpreter
• Compiler menerjemahkan Bahasa pemrograman tingkat tinggi untuk seluruh
source code dari baris pertama hingga baris terakhir.
• Hasil kompilasi dapat dijalankan tanpa tergantung pada keberadaan source code
Interpreter Python
• Program Python dapat ditulis dalam sebuah IDE (Integrated Development
Environment)
• Anaconda Python menyediakan IDE bawaan Spyder
• Source code ditulis dalam Spyder, dan langsung dieksekusi (shortcut F5)
• Program Python juga dapat dijalankan melalui Anaconda Prompt
Interpreter Python
• The standard implementation of Python is interpreted.
• You can find info on various implementations here.
• The interpreter translates Python code into bytecode, and this bytecode is
executed by the Python VM (similar to Java).
• Two modes: normal and interactive.
• Normal mode: entire .py files are provided to the interpreter.
• Interactive mode: read-eval-print loop (REPL) executes statements piecewise.
Interpreter: Normal mode
• Let’s write our first Python program!
• In our favorite editor, let’s create helloworld.py with the following contents:
# here’s a comment
• Comments for i in range(0,3):
print i
• Single-line comments denoted by #.
def myfunc():
• Multi-line comments begin and end with three “s. """here’s a comment about
the myfunc function"""
• Typically, multi-line comments are meant for documentation.
print "I'm in a function!"
• Comments should express information that cannot be expressed
in code – do not restate code.
Python typing
• Python is a strongly, dynamically typed language.
• Strong Typing
• Obviously, Python isn’t performing static type checking, but it does prevent mixing
operations between mismatched types.
• Explicit conversions are required in order to mix types.
• Example: 2 + “four” not going to fly
• Dynamic Typing
• All type checking is done at runtime.
• No need to declare a variable or give it a type before use.
Operation Result
s[i] = x Item i of s is replaced by x.
s[i:j] = t Slice of s from i to j is replaced by the contents of t.
del s[i:j] Same as s[i:j] = [].
s[i:j:k] = t The elements of s[i:j:k] are replaced by those of t.
del s[i:j:k] Removes the elements of s[i:j:k] from the list.
s.append(x) Add x to the end of s.
Common sequence operations
That’s not enough to create a useful program, so let’s get some control flow tools
under our belt.