Lecture 01 - Intro To Python
Lecture 01 - Intro To Python
Lecture 01 - Intro To Python
Programming
Le Thanh Son
Hardware and Software
• Hardware
– Computers are dumb
– The electronics, circuits, monitor, mouse, keyboard,
devices of the computer.
• Software
– The Operating Systems:
• interface between hardware and software
• manage input/output, resources, handle execution of programs.
• Multitasking
• Unix, Linux, Windows, Mac OSX…
– Programs and applications that run on computer.
– Early computers had to be rewired in order to run different
application.
– Software allow using the same computer for multiple
application
The Moore’s Law
• Every two years, the capacities of computers are
doubled inexpensively
• By Gordon Moore, co-founder of Intel
• Observations apply to
– Memory
– Storage
– Processor speed…
• Still applied
Computer Organization
• Input Unit
– Input devices
– Keyboards, touch screens, mouses, voice command,
reading from secondary storage devices…
• Output Unit
– Output devices
– Screens, printers, secondary storage devices, VR devices…
• Arithmetic and Logic Unit (ALU)
– Perform calculations
• Central Processing Unit
– Administrative section
• Storage
– Primary storage, main memory, volatitle
– Secondary storage
Data
• Bits
– Binary digit: 0 or 1
• Characters
– Decimal digits
– Letters
– Symbols
• Fields
• Records
• Files
• Databases
• Big Data
– KB, MB, GB, TB
– PB, EB, ZB
Computer Program
• What is a computer program
– Collection of instructions
– Approach/method used to solve a problem: ALGORITHM
– Different program different set of actions, different task
– The machine (hardware) stays the same, but the program
changes
– Easier to change software than hardware
Programming
• The process of making software is called
programming
• Write the instructions necessary to implement the
algorithm using programming language
• Why programming?
– Computers are popular
– Everything uses computer: phones, laptops, cars, toys, airplanes…
Programming Language
• Express the computer instructions in particular
statements
• Natural language has ambiguity and imprecision
problems when describing complex algorithm
• Programs express in unambiguous, precise way
• Syntax
• Semantic
• Process of implementing an algorithm in a
programming language: coding
Programming Language
• Machine Languages
– Binary
– Machine dependent
• Assembly Languages
– Use abbreviations to present operations
– Example:
add payment bonus
store payment
– Need assembler to convert to machine language
• High Level Languages
– Similar to everyday English, understood by humans
– Use common mathematical notations
– Need compiler/translator to convert to machine understandable form
– Example: Python, C, C++, Java…
• Compiling vs Interpreting
Structured (Procedural)
Programming Technology
• Disciplined approach to programming: clear and easy
to modify
• Making extensive use of control flow structures:
sequential statements, selection, repetition, block,
subroutines
• Example: Pascal, C
Object-Oriented
Programming Technology
• Organized software design around data, objects
• Object: attributes + behaviors
• Object interact with each other
• Example: C++, Java, Smalltalk, Python
History of Python
• Created in 1989 by Guido van Rossum
– Created as a scripting language for administrative tasks
– Based on All Basic Code (ABC) programming language
– Named after popular BBC comedy show at that time,
“Monty Python’s Flying Circus”
• Released publicly in Feb 1991, version 0.9
– Fast growing
– Well-supported programming language
– 3.0 released in 2008
Python
• Python is a scripting language
– Not compiled as an executable file
• Structured programming like C
• OOP like C++
• Open source
Uses of Python
• Data Science
• Data Mining
• Desktop Applications
• Artificial Intelligence
• Web App
• Machine Learning
• Computer Vision…
Popular Frameworks and Libraries
• Web (server): Django, Flask, Pyramid, CherryPy
• GUI: Tk, PyGTK, PyQt, PyJs
• Machine Learning: TensorFlow, PyTorch
• Mathematics: NumPy, Pandas
Difference between 2.x and 3.x