0% found this document useful (0 votes)
9 views11 pages

A Computer

The document provides a comprehensive overview of computer hardware and software components, detailing the roles of the CPU, memory, storage devices, input/output devices, and communication devices. It also explains programming concepts, including languages, algorithms, data types, and the software development process. Additionally, it covers Python programming specifics, including syntax, functions, loops, and error handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views11 pages

A Computer

The document provides a comprehensive overview of computer hardware and software components, detailing the roles of the CPU, memory, storage devices, input/output devices, and communication devices. It also explains programming concepts, including languages, algorithms, data types, and the software development process. Additionally, it covers Python programming specifics, including syntax, functions, loops, and error handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

A computer’s hardware components are interconnected by bus

subsystem, which is built into a motherboard:


- CPU: central processing unit: is a computer's brain. It retrieves
instructions from memory and executes them. Today, CPU is
built on semiconductor chips that contain millions of transistors,
for processing information.
- Memory: main memory: stores data and program instructions
for the CPU to execute. It is volatile because information is lost
when the power is turned off.
- Storage devices: stores programs and data permanently.
- Input devices
- Output devices
- Communication devices: Modem and NIC
Hardware is the physical aspect of the computer that can be
touched.
Software is the invisible instructions that control the hardware
and make it perform tasks.
CPU:
- Control unit: control and coordinates the actions of the other
components
- Arithmetic/logic unit: performs numeric operations and logical
operations.
- Speed: hertz (Hz), megahertz (MHz), gigahertz (GHz)
- Core: part of the processor that performs the reading and
executing of instructions
Encoding scheme: set of rules that govern how a computer
translates characters and numbers into data that computer can
understand.
Bits: binary digits (0 or 1/ off or on)
Byte (B = 8 bits): minimum storage unit
Kilobyte (KB = 1000 B)
Megabyte (MB = 1 million B)
Gigabyte (GB = 1 billion B)
Terabyte (TB = 1 trillion B)
Memory:
- Memory is like a work area for programs. Before a program is
executed, it is brought into the memory.
- Unique address: every byte in the memory has a unique
address
- RAM: random-access memory because the bytes can be
accessed directly in any order.
- Volatile: Any information in memory is lost when the system’s
power is turned off.
Storage devices:
- Hard disk drives: HDDs: traditional, cheaper
- Solid-State drives: SSDs: new, faster, more efficient
- Soft disk drives
- Optical disc drives
- USB flash drives
Input devices:
- Function keys: f1, f2,..
- Modifier keys: Shift, Alt,…
- Numeric keys
- Arrow keys
Communication devices:
- Dial-up modem: uses a phone line to dial a phone number to
connect Internet (56000 bps bits per second)
- DSL digital subscriber line: phone line without dial, but faster
20 times
- Cable modem: TB cable
- NIC network interface card: connect to LAN local area
network, or INTERNET
- Wireless network
Language:
- Machine Language: computer’s native language (binary codes)
- Assembly language: low-level language (close in nature and
machine dependent) using mnemonic (short descriptive word) to
represent machine-language instructions.
- Assembler: translate assembly to machine
- High-level language: English-like language with
statements(instructions): Ada, BASIC, C, C++, C#, COBOL,
FORTRAN, Java, JavaScript, Pascal, Python, Visual Basic
- Source program or source code: programs written in high-
level language
- Interpreter (Python) or compiler: translate source code into
machine code
- Interpreter: Reads, translates, and executes one statement from
source code into output right away
- Compiler: translates the entire source code into machine code
then execute them into output
OS Operating System: Microsoft Window, Mac os, linux
- Controlling and monitoring system activities
- Allocating and assigning system resources: determine what
computer resources a program need
- Scheduling operation: schedule programs’ activities to make
efficient use of system rsource:
+ Multiprogramming: allow multiple programs run at the same
time by sharing the same CPU
+ Multithreading: allow a single program to execute multiple
tasks at the same time
+ Multiprocessing: same with above, but run multiple programs
at the same time using multiple processors
Python:
- Created by Guido van Rossum in Netherlands 1990
- General-purpose programming language
- Can run on Window, UNIX, and Mac
- Interpreted: is able to be translated and executed by an
interpreter
- OOP object-oriented programming language
- Python 3 cannot backward to python 2
- Console: text entry and display device
- Launching python: command prompt, IDLE interactive
development environment
- >>>: Python statement prompt(Interactive mode)
- Interactive mode: cannot be saved
- Script mode: can be saved
- #: Python comments
- Indentation: matter
- Case sensitive
- Error:
+ Syntax error: code construction, detected by the interpreter
+ Runtime error: cause a program to terminate abnormally
+ Logic error: occurs when a program does not perform its
intended task
- Algorithm: list the actions that need to be taken to solve a
problem and their order
- Pseudocode: natural language mixed with programming code
- IPO: tands for Input, Process, and Output, which are the typical
three steps for most simple programs in the text.
- Variable: value stored in computer’s memory with descriptive
names
- Datatypes: Python auto do it:
+ Python auto convert number into a string for displaying
- Joined implicitly: when a statement is not finished and Python
auto take the following and joint them together. (Or using /)
Identifiers:
- Letters, digits, *, and underscore
- Must start with letter or underscore
- Cannot be keywords
- Case sensitive
- Assignment operator(=)
- Assignment statement: variable = expression
- Expression: x+1
- Chained assignment: x = y = a = 1
- Simultaneous assignment: x, y = y, x
- Scope of a variable: is the part of the program where the
variable can be referenced.
- Constant
- Variable must be created before use
- Unary operator: negative -
- Binary operator: substract –
- True/float division: /
- Floor/interger division: //
- Overflow: when the result of an expression is too large to be
stored in memory
- Underflow: when the result of an expression is too small to be
stored in memory
The UNIX epoch: is the time 00:00:00 on January 1, 1970
GMT.
Sofware development process:
- Requirement specification (IPO): is a formal process that seeks
to understand the problem that the software will address and to
document in detail what the software system needs to do.
- System analysis (IPO): seeks to analyze the data flow and to
identify the system's input and output.
- System design (IPO): is to design a process for obtaining the
output from the input.
- Implementation: involves translating the system design into
programs.
- Testing: ensures that the code meets the requirements
specification and weeds out bugs.
- Deployment: makes the software available for use.
- Maintenance: is concerned with updating and improving the
product.
Boolean: True or False
- ==: if =
- not
- and
- or
Order in expression:
- positive, negative
- **
- not
-*/
-+-
-<>
- = !=
- and
- or
- +=,…
- Conditional expression: Expression1 if boolean expression else
expression2
Y = 1 if x > 0 else -1
Short-circuit evaluation: and/or
Escape sequence: \
- \b: backspace
- \t: tab
- \n: linefeed
- \f: force the printer to print from the next page
- r\: move the cursor to first position on the same line
- \\: \
- \’
- \”
- x in y: return true or false
- not in
- Index operator: []
- s[start:end]: the position of a character in a string with start and
end-1
- s[x]: only 1 character
ASCII: stands for American Standard Code for Information
Interchange, an 8-bit encoding scheme for representing all
uppercase and lowercase letters, digits, punctuation marks, and
control characters.
- Encoding: is to map a character to its binary representation.
- Escape sequence: \
- Escape character: \n,…
- Whitespace Character: ‘ ‘
Loop:
While loop
- While loop-continuation-condition:
Loop body
- Loop count from 0
- Loop Body: is the part of the body that contains the statements
to be repeated.
- Iteration: is one time execution of the loop body.
- Loop Continuation Condition: is a Boolean expression that
controls the execution of the loop.
- Infinite Loop: is a loop that runs forever due to an error in the
code.
- Off-by-one: is an error in the program that causes the loop
body to be executed one more or less time.
- Sentinel Value: is a special value that signifies the end of the
input.
- Sentinel-Controlled Loop: is a loop that uses a sentinel value to
control its execution is called a sentinel-controlled loop.
- Input Redirection: is to redirect the input from a data file rather
from the keyboard.The file is specified at the command line
after the symbol <.
- Output Redirection: is to redirect the input from a data file
rather from the keyboard.The file is specified at the command
line after the symbol >.
For loop: a count-controlled loop used to execute a loop body in
a predictable number of times
For var in range(initial,end,step)
Continue: break out of an iteration
Break: break out of the loop
- Function:
+ print( , end= “ ”): print(x,y,z) = x y z
+ exit()
+ input()
+ str(): return a string
+ len(string): return the numbers of characters in a string
+ max(string): return the largest character in a string
+ min(string): return the smallest character in a string
+ lower(): lower case
+ upper(): upper case
+ isalnum(): return True if all characters are number and
alphabet
+ isalpha(): returns True if all character are alphabet
+ isdigit(): returns True if all character are number
+ isidentifier()
+ islower(): returns True if all lowercase
+ isupper(): returns True if all uppercase
+ isspace(): returns True if only whitespace
+ endswith()
+ startswith()
+ find(): return the lowest index(position), if cannot find return
-1
+ rfind(): return the highest index(position), if cannot find return
-1
+ count(): return the number of the character occurred in the
string
+ capitalize(): return only first character capitalized
+ lower(): return all lowercase
+ upper(): return all uppercase
+ title(): return the string with the first letter capitalized in each
word
+ swapcase()
+ replace(old, new)
+ replace(old, new, n): replace in only n times
+ lstrip(): remove left whitespace
+ rstrip(): remove right whitespace
+ strip(): remove both left and right white space
+ id(object):
+ type(object):
+ float(): float(input())
+ int(): int(input()): cut the fractional part, not rounding up
+ round(x): round up/down to nearest. If .5, return the EVEN
one
+ round(x, n): return float value rounded to n digits after decimal
point(ko return Even)
+ format(x, “field.precisionnotation”): return x with precision
number after decimal point. Field will auto increase if need.
+ time()
+ randint(a,b): generate a random integer between a and b
+ randrange(a,b): generate a random integer between a and b-1.
If randrange(7) = randrange(0,7)
+ random(): generate a random float between 0 and 1
+ if: elif: else: nest(if in if), multi(if with multi elif)
+ match: case
+ range(first, end, step): interger only, end -1
+ abs(): returns the absolute value
+ math.fabs(): returns the absolute value as a float
+ max(x1, x2): Return the largest
+ min(x1, x2): Return the smallest
+ pow(a,b): a ** b
+ math.ceil(): round up to integer
+ math.floor(): round down to integer
+ math.exp(x): e ** x
+ math.log()
+ math.log(x, base): return for the specified base
+ math.sqrt(): square root
+ math.hypot(): return sqrt(x**2 + y**2)
+ math.sin(),…
+ math.asin(),…: return the reversed
+ math.degrees()
+ math.radians()
+ ord(): return ASCII code from character(ASCII code between
upper and lower case(larger than upper) is 32)
+ chr(): return character from ASCII code

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