Lecture 01 - Intro To Python

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Introduction 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

Basic comparison 3.x 2.x


Year 2008 2000
Function print print(“Hello”) print “Hello”
Division of integers Float value Integer value
Unicode Default is Unicode String needs to be defined
with “u”
Syntax Simpler Comparatively more
difficult to read
IDEs
• Pycharm
• Visual Studio Code
• Jupyter Notebook
• Google Colab
Let’s Python
• Download Python:
https://www.python.org/downloads/
• Install. Mac OSX: can install from Homebrew
• Check version: python -version
QnA

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy