Cpen Reviewer
Cpen Reviewer
• A programmer, or software developer, is a person with the training and skills necessary to
design, create, and test computer programs.
HARDWARE
• The term hardware refers to all of the physical devices, or components, that a computer is
made of.
• A computer is not one single device, but a system of devices that all work together.
• A typical computer system consists of the following major components:
•The central processing unit (CPU)
•Main memory
•Secondary storage devices
•Input devices
•Output devices
CPU
• The central processing unit, or CPU, is the part of a computer that actually runs programs.
• The CPU is the most important component in a computer because without it, the computer
could not run software.
• In the earliest computers, CPUs were huge devices made of electrical and mechanical
components such as vacuum tubes and switches.
● The ENIAC (Electrical Numerical Integrator and Computer), considered by many to
be the world’s first programmable electronic computer. This machine, which was
primarily one big CPU, was 8 feet tall, 100 feet long, and weighed 30 tons.
•Today, CPUs are small chips known as microprocessors. Smaller than the old
electro-mechanical CPUs in early computers; microprocessors are also much more powerful
MAIN MEMORY
• Main memory is where the computer stores a program while the program is running, as
well as the data that the program is working with.
• Main memory is commonly known as random-access memory, or RAM.
• RAM is usually a volatile type of memory that is used only for temporary storage while a
program is running.
• When the computer is turned off, the contents of RAM are erased.
INPUT DEVICES
• Input is any data the computer collects from people and from other devices.
• The component that collects the data and sends it to the computer is called an input
device.
• Common input devices are the keyboard, mouse, scanner, microphone, and digital camera.
OUTPUT DEVICES
• Output is any data the computer produces for people or for other devices.
• The data is sent to an output device,which formats and presents it.
• Common output devices are video displays and printers.
STORING CHARACTERS
• Any piece of data that is stored in a computer’s memory must be stored as a binary
number That includes characters, such as letters and punctuation marks.
• When a character is stored in memory, it is first converted to a numeric code then numeric
code is then stored in memory as a binary number.
• The most important of these coding schemes is ASCII, which stands for the American
Standard Code for Information Interchange.
• ASCII is a set of 128 numeric codes that represent the English letters, various punctuation
marks, and other characters.
• Unicode is an extensive encoding scheme that is compatible with ASCII, and can also
represent the characters of many of the world’s languages.
FETCH-DECODE-EXECUTE CYCLE
1.Fetch or read instruction in the program from memory into the CPU.
2.Decode the instruction to determine which operation to perform.
3.Execute or perform the operation.
SOFTWARE
• Programs generally fall into one of two categories:
>System software control or enhance the operation of a computer.
>Application software makes a computer useful for everyday tasks
SYSTEM SOFTWARE
● System software typically includes the following types of programs:
● Operating System controls internal operations of the computer’s hardware,
manages all devices connected to the computer, allows data to be saved to and
retrieved from storage devices, and allows other program to run on the computer.
(i.e. Windows, IOS, Mac OS, Linux)
● Utiliy Programs performs a specialized task that enhances the computer’s operation
or safeguards data. (i.e. virus scanners, file compression programs and data
back-up)
● Software Development Tools are the programs that programmers use to create,
modify, and test software. (i.e. assemblers, compilers, and intepreters)
LESSON 2
● It provides an organized plan for breaking down the task of program development
into manageable chunks, each of which must be completed before moving on to the
next phase.
● The Program Development Life Cycle (PDLC) is like a step-by-step guide that
helps developers create quality software efficiently. Think of it like building a
house—you need a plan to ensure everything gets done in the right order and is built
properly.
● PDLC breaks down software development into smaller, manageable parts or phases.
Each phase focuses on a specific part of the process, and you can’t move to the next
phase until the current one is complete. This approach ensures that the software is
well-designed, free of major errors, and meets the user’s needs.
•The word “algorithm” relates to the name of the mathematician Al-Khwarizmi, which means
a procedure or a technique.
4. Use software (compiler or interpreter) to translate the program into machine language
● Each computer knows only one language: its machine language, which consists of
1s and 0s.
● Syntax error is a misuse of a language’s grammar rules.
● CREATING THE EXECUTABLE PROGRAM
When writing a program, a programmer might need to recompile the code several times. An
executable program is created only when the code is free of syntax errors. When you run an
executable program, it typically also might require input data. Figure 1-2 shows a diagram of
this entire process.
● A logical error results when you use a syntactically correct statement but use the
wrong one for the current context.
● Once a program is free of syntax errors, the programmer can test it—that is, execute
it with some sample data to see whether the results are logically correct.
● A program that is free of syntax errors is not necessarily free of logical errors. A
logical error results when you use a syntactically correct statement but use the wrong
one for the current context.
● The process of finding and correcting program errors is called debugging.
● Once the program is tested adequately, it is ready for the organization to use.
● The process might take months if the program will be run on a regular basis, or if it is
one of a large system of programs being developed.
● Conversion is the entire set of actions an organization must take to switch over to
using a new program or set of programs, can sometimes take months or years to
accomplish.
● After programs are put into production, making necessary changes is called
maintenance.When you make changes to existing programs, you repeat the
development cycle.
2. FLOWCHART
DRAWING FLOWCHARTS
● Flowcharts allow programmers to visualize
more easily how the program statements will
connect.
● Flowcharts are an excellent tool to help
them visualize how the statements in a program are
interrelated.
● INPUT SYMBOL - •Indicates an input
operation. You write an input statement in English
inside the parallelogram.
● PROCESSING SYMBOL- •Rectangle is
used as the processing symbol. It contains a
processing statement. Arithmetic operation
statements are examples of processing
●
● OUTPUT SYMBOL- •Output statement, use the same symbol as for input
statements.
●
● Use arrows, or flowlines, to connect the steps and show the correct sequence of
these statements.
● Most of a flowchart should read from top to bottom or from left to right on a page.
● Terminal symbols, or start/stop symbols are used in the beginning and end of the
flowchart.
● You represent a decision in a flowchart by drawing a decision symbol, which is
shaped like a diamond.
● The diamond usually contains a question, the answer to which is one of two mutually
exclusive options—often yes or no.
FLOWCHART PSEUDOCODE
USES OF PYTHON
● Better search results are provided based on ranking of the websites and much more
● The Server and Client applications are coded using Python
● Machine learning is used to cluster users based on their interest on shows and retain
them for longer
● Cyber-security analysis and other encryption and decryption work is done using
Python
● Transfer of files between peer-to-peer which started out as a normal Python file
● Scientific calculations are computed using Python
IDLE
● Simple integrated development environment (IDE)
● Python’s built-in Integrated Development and Learning Environment
● Allows to type program and run
FIRST PROGRAM
► Step 1: Start IDLE and open new window. Type:
► Step 2: Press F5 or click Run and Save. Append
.py to the filename.
SECOND PROGRAM
Here is a program that computes the average of two numbers that user enters:
GETTING INPUT
● The input function is a simple way for your program to get information from people
using your program.
PRINTING
● The print function requires parentheses
QUOTATION IN PYTHON
● Python accepts single (‘), double (“) and triple (“““) quotes to denote string
● Quote starts and ends the string
● Triple quotes – span the string across multiple lines
COMMENTS IN PYTHON
● hash (#) – place at the beginning of a comment
● Comment – set as mark and Python ignores these
OPTIONAL ARGUMENTS
sep – short for separator, change space to any symbol
VARIABLES
● Variable remembers the value of certain data
● Variable names can contain letters, numbers, and the underscore
● Variable names cannot contain spaces
● Variable names cannot start with a number
● Case matters – temp and Temp are different
RANDOM MODULE- The random module allows you to generate random values, which is
helpful in many programming contexts.
MATH MODULE AND FUNCTIONS
EXAMPLES
Write a program that: calculate and display the square root of 16; calculate and display the
sine of 90 degrees; display the value of pi
ASCII CODE TABLE