0% found this document useful (0 votes)
22 views56 pages

Intro To Comp and Prop - DAY 1

The document provides an introduction to computers and programming, including definitions of key concepts like hardware, software, operating systems, and binary. It outlines the course, including topics to be covered, assignments, and grading. It also gives an overview of the history of computers from the ENIAC to Moore's Law.

Uploaded by

lam.le220912
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)
22 views56 pages

Intro To Comp and Prop - DAY 1

The document provides an introduction to computers and programming, including definitions of key concepts like hardware, software, operating systems, and binary. It outlines the course, including topics to be covered, assignments, and grading. It also gives an overview of the history of computers from the ENIAC to Moore's Law.

Uploaded by

lam.le220912
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/ 56

INTRODUCTION TO

COMPUTER AND PROGRAMMING

LESSON 1

1
CONTENT
1. Brief Introduction(s)
2. Course Overview
3. Lecture: Computers, Programming Languages

Introduction to Computer and Programming 2


INTRODUCTION
• Lecturer: LE DINH DUNG
• Email: [email protected]
• My research interests are in several areas:
• Machine Learning and Artificial Intelligence
• Internet of Things
• Wireless Communications

Now, it’s your turn!

Introduction to Computer and Programming 3


INTRODUCTION
• Poll Questions on Poll Everywhere:

• How much Computer Programming have you done?


• Have you ever used Python before?

When poll is active, response at:


pollev.com/dungledinh739

Introduction to Computer and Programming 4


INTRODUCTION
• How much Computer Programming have you done?

Introduction to Computer and Programming 5


INTRODUCTION
• Have you ever used Python before?

Introduction to Computer and Programming 6


COURSE OVERVIEW
• Course Name: Introduction to Computer and Programming
• Credits: 03
• Durations: 20 sessions ( 10 weeks)
• Lecturer: Dung Le-Dinh – email: [email protected] ;

Introduction to Computer and Programming 7


COURSE OVERVIEW
• Lecture 01: Welcome to the Course! Computers, Programming
Languages
• Lecture 02: Software Development, Intro to Python (Environment setup)
• Lecture 03: Variables, Working with User Input
• Lecture 04: Data Types, Errors and Debugging,
• Lecture 05: Advanced Math Operations & Formatting Output
• Lecture 06: Decision Structures & Boolean Expressions
• Lecture 07: Condition Controlled Loops
• Lecture 08: Condition Controlled Loops in Practice
• Lecture 09: Count Controlled Loops(For Loops), range(), break and
continue
Introduction to Computer and Programming 8
COURSE OVERVIEW
• Lecture 10: Functions, Variable Scope and Modules
• Lecture 11: Functions - Part Two
• Lecture 12: Midterm Review
• Lecture 13: Introduction to String Manipulation
• Lecture 14: The list data type
• Lecture 15: Strings & Lists, Working with the Web and an Introduction to
File Input & Output
• Lecture 16: Dictionaries and Sets
• Lecture 17: Intro to Object Oriented Programming
• Lecture 18: OOP Review & Final Exam Review
Introduction to Computer and Programming 9
COURSE OVERVIEW: Grading
Your grade in this course will be determined based on the items below:
• Assignments: 30%
• Attendance/Quizzes: 5%
• Midterm Exam: 30%
• Final Exam: 35%

Introduction to Computer and Programming 10


COURSE OVERVIEW: Grading
• Assignments: 30%
Around 10-11 assignments (practice labs/ homeworks)

Introduction to Computer and Programming 11


COURSE OVERVIEW: Grading
• Attendance/Quizzes: 5%
Online quizzes/ activities to check check what you’ve learned!
(and/or your participations)

Introduction to Computer and Programming 12


COURSE OVERVIEW: Grading
• Midterm Exam: 30% (TBD)
• Final Exam: 35% (TBD)

Introduction to Computer and Programming 13


COURSE OVERVIEW: LEARNING MATERIALS
• How to Think Like a Computer Scientist by Jeffrey Elkner, Allen B. Downey, and Chris Meyers
• Python for Everybody: Exploring Data Using Python 3 by Charles Severance, University of
Michigan

• Extra materials/ Self-learning from LMS

Introduction to Computer and Programming 14


COURSE OVERVIEW: CLASS RULES

• Because this class involves in-class programming assignments, it's highly


encouraged that you bring a laptop to class. If you don't have a laptop during in-
class work, then you may work with a partner.

Introduction to Computer and Programming 15


What is a Computer?

Introduction to Computer and Programming 16


What is a Computer?
• A machine that processes information based on a program.
• Virtually all electronic devices are computers.

Introduction to Computer and Programming 17


What is a Computer?
• The physical devices of which a computer is made are referred to as the
computer’s hardware.

• The programs that run on a computer are referred to as software.

Introduction to Computer and Programming 18


Hardware

Hardware refers to all of


the physical devices, or
components, of which a
computer is made.

Introduction to Computer and Programming 19


The Processor

• The processor acts as the computer’s “brain” and coordinates all


activity.
• As far as a brain goes, the processor isn’t very bright – it can only
perform four distinct actions:
n Receive a new instruction (Fetch)
n Make sense of this instruction (Decode)
n Perform the action defined by this instruction (Execute)
n Store the result of the action (Store)
• These processors, sometimes called a CPU or “Central
Processing Unit,” are made up of miniaturized transistors and
circuits on a semiconductor.

Introduction to Computer and Programming 20


The ENIAC (1945)
Electronic Numerical Integrator and Computer

ENIAC - Wikipedia ENIAC | History, Computer, Stands For, Machine, & Facts | Britannica
Introduction to Computer and Programming 21
Introduction to Computer and Programming 22
Moore’s Law

• Advances in chip design have facilitated these technologies thanks


to Moore’s Law.
• The empirical observation that at our rate of technological
development, the complexity of an integrated circuit— with
respect to minimum component cost - doubles in about 24
months.
• Expected to continue until around 2020

Introduction to Computer and Programming 23


Moore’s Law

Introduction to Computer and Programming 24


Moore’s Law

Does Moore’s Law still hold?

Introduction to Computer and Programming 25


Memory
• Computers, like us, need short term
memory in order to function properly.
• We call this RAM or “Random
Access Memory”
• It’s very fast!
• We call it “Random” since the
computer can selectively read and
write to it’s RAM .
• When a computer turns off, it loses
its short-term memory (we call this
volatility)

Introduction to Computer and Programming 26


Storage
• Temporary storage is accomplished
in memory (RAM).
• We use RAM for short term memory
because it is very fast, but it is also
volatile and loses information if it is
denied of electricity.
• Long term storage is, by definition,
non-volatile – it has the ability to
persist even if the power is off

Introduction to Computer and Programming 27


Input Devices
• Input devices allow us to
communicate “real world”
information into a format that the
computer can understand

Introduction to Computer and Programming 28


Output Devices
• Output devices translate the internal
workings of your computer into “real
world” stimulus

Introduction to Computer and Programming 29


Software
• Software is, in essence, a set of instructions that tell our
computers how to behave

• Software is fluid, and can easily be changed up updated

Introduction to Computer and Programming 30


The Operating System
• Specialized software that
coordinate all activities among
hardware
• Contains instructions for running
application software
• Also known as a “platform” or
“software platform”
• Programs that run on different
operating systems are know as
“cross platform” applications

Introduction to Computer and Programming 31


The User Interface
• Portion of System Software that
allows you to interact with Data
• Two types:
n Graphical (GUI)
n Command Line

• GUI is more user-friendly, but


command line is faster.

Introduction to Computer and Programming 32


Application Software
• Software that serves to help
“users more productive and/or
assist them with personal tasks”

• Application Software is
described as a set of programs
that are designed to perform
specific tasks for the user.

Introduction to Computer and Programming 33


Data Storage

It’s all Zeros and Ones …


• Everything that communicates with a
computer “speaks” the same language
(binary).

• Only two “letters” in this language – “0”


and “1” which really correspond to
electrical impulses (+5v / -5v)

Introduction to Computer and Programming 34


Binary
• Only 2 "letters" in the entire language (0 and 1)

• A single 0 or 1 is referred to as a "bit”


n bit: 1

• Groupings of 8 bits are referred to as a "byte”


n byte: 01001011

• 1 byte has the possibility of having 256 unique "states"

Introduction to Computer and Programming 35


Counting in Binary (0 to 255)
Converting Binary to Decimal
• Write eight slots for each binary digit
• To compute a decimal, add up corresponding power of two in each
position where there is a one
• General formula to convert any binary to decimal

• Binary notation equation for eight positions:

• Example: 10011011 in decimal?

Introduction to Computer and Programming 36


Counting in Binary (0 to 255)
• What is 10011011 in decimal?

Introduction to Computer and Programming 37


Counting in Binary (0 to 255)
Decimal to Binary

Introduction to Computer and Programming 38


Counting in Binary (0 to 255)
• We are in the year 2023. What is 23 in Binary?

Introduction to Computer and Programming 39


Encoding Characters

Introduction to Computer and Programming 40


Encoding Audio

Introduction to Computer and Programming 41


How a Program Works

Computers aren’t smart!


(they’re just really, really, really, really, really, really fast!)

Introduction to Computer and Programming 42


How a Program Works

Most computers can only do a handful of things


n Read information from memory

n Add, subtract, multiply, divide numbers

n Move data to memory or to permanent storage

n Compare values

Introduction to Computer and Programming 43


“Machine Language”

Introduction to Computer and Programming 44


So what can a computer do?
n Processors can only perform a few very simple operations

n Each processor has a fixed number of capabilities, called its “instruction set”

n Each manufacturer maintains its own instruction set

Introduction to Computer and Programming 45


So what can a computer do?
For a program to be meaningful we need lots of instructions!

Usually on the order of millions or billions


n Programs are generally stored on external devices, but they must be
copied into memory
as needed
n Once in memory the CPU can begin to work its magic
n Fetch
n Decode
n Execute
n Store

Introduction to Computer and Programming 46


High Level Languages
• Program was solved in the 1950s
when Grace Hopper—a Captain in the
US Navy (at the time) - helped invent
COBOL
• The big idea: Take English words and
translate them into machine language
in a way that was “device
independent”
• Allowed programmers to concentrate
on the tasks the needed doing, not on
the mechanics of how a machine
worked

Introduction to Computer and Programming 47


High Level Languages

Introduction to Computer and Programming 48


High Level Languages

Introduction to Computer and Programming 49


Many, many high level languages
n COBOL
n Java
n Visual Basic
n PHP
n C
n C++
n Python
n JavaScript
n ActionScript

http://en.wikipedia.org/wiki/List_of_programming_languages
Introduction to Computer and Programming 50
High-Level Programming Language Structure
Programming Language Structure: Key Words

n Defined list of words that make


up the language

n Sometimes called “Reserved


Words”

Introduction to Computer and Programming 51


High-Level Programming Language Structure
Programming Language Structure: Operators

n Special symbols that perform answer = 5 + 2


certain actions on pieces of
data name = ‘Harry’ + ‘Potter’

average = 250 / 300

Introduction to Computer and Programming 52


High-Level Programming Language Structure
Programming Language Structure: Syntax

n Set of rules that must be


followed when writing a program
if name == ‘naim’:
print (‘Hi there!’)
else:
print (‘Who are you?’)

Introduction to Computer and Programming 53


High-Level Programming Language Structure
Programming Language Structure: Statement

n Instructions that you write,


consisting of keywords, operators,
punctuation, etc average = average * 2

Introduction to Computer and Programming 54


High-Level Programming Language Structure
High Level Languages: Code

n All statements you write while


programming is referred to as
“code” or “source code”
(we don’t say “source codes”)

Introduction to Computer and Programming 55


Python

n This semester we will be working with


Python
n High level interpreted language
n Used extensively as both a production
language as well as a teaching language
n Two modes
n Interactive
n Script
n IDLE
n Integrated Development
Environment

Introduction to Computer and Programming 56

You might also like