The document discusses various topics in computer programming including data types, operators, algorithms, flowcharts, pseudocode, errors, debugging, control structures like conditionals and loops, and data structures like lists, tuples, sets and dictionaries. It also discusses functions and how to define them in Python.
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 ratings0% found this document useful (0 votes)
34 views2 pages
Comprog 1 Reviewer
The document discusses various topics in computer programming including data types, operators, algorithms, flowcharts, pseudocode, errors, debugging, control structures like conditionals and loops, and data structures like lists, tuples, sets and dictionaries. It also discusses functions and how to define them in Python.
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/ 2
COMPROG 1 FINALS REVIEWER
PROBLEM – something the result of which is not readily 1. Numeric
available. Integer (int) – for whole numbers Float (float) – for decimals Law of Equifinality – same goal can be achieved through 2. String (str) – for characters; letters, numbers, symbol different courses of action and a variety of paths. 3. Boolean (bool) – George Boole – for true or false ALGORITHMS –mathematician Al-khowarizmi , which means BASIC OPERATORS a procedure or a technique. Arithmetic Operators – mathematical operations A set of steps that generates a finite sequence of operations which leads to the solution of a given Comparison (Relational) Operators – tru or folz problem. Assignment Operators – assigns value to a variable Logical Operators – combining logical statements FLOWCHART – is a pictorial or diagrammatic representation of an algorithm so that it can be easier and quicker to ESCAPE CHARACTERS/backslash (\)– allows us to avoid errors understand. caused by using “illegal characters” \n – inserts a new line in the text SYSTEM FLOWCHART – contain solutions of many \t – inserts a tab in the text problem units together \’ – inserts a single quote character PROGRAM FLOWCHART –contain steps to solve a \” - inserts a double quote character problem to achieve a specific result. Error can be easier \\ - inserts a backslash character to detect because it is a visual representation of the logic CONCATENATION ( + or , ) – process of merging two or more of a program strings, on either sides PSEUDOCODE – combining natural and programming TYPE CASTING - the method to convert the variable datatype language to describe computer algorithms. Easiest way to into a certain data type. represent an algorithm or program. Explicit type conversion – done by the user MODULO OPERATOR / remainder operator (%) - returns the Implicit type conversion – automatically performed remainder when the first operand is divided by the second by the interpreter operand. PRECISION HANDLING USING % - determines the number of digits to be displayed after the decimal point NATURAL LANGUAGE – languages that humans speak MACHINE LANGUAGE – composed of binary digits FIRST BUG – Harvard University, 1947 Mark II was having consistent errors; a literal bug PROGRAMMING LANGUAGE - Set of commands, instructions, disrupted the electronics of the computer. and other syntax use to create a software program. TYPES OF ERRORS: PROGRAM – organized list of instructions that causes Syntax Error (parsing error) – caused by improper computer to behave in a predetermined manner. format or syntax. Semantic Error – when the syntax is correct but the PYTHON – conceptualized by Guido van Rossum. Started in program logic is not, resulting to incorrect output. 1989. A high-level programming language with applications in numerous areas. DEBUGGING – process of finding and correcting errors or bugs in the program code. Editor- where you type your code DEBUGGER – helpful for finding and correcting bugs that are Code- commands or instructions written in a particular difficult to find. programming language Decision Control statement - a statement that determines the control flow of a set of instructions. Interpreter- prompts the computer to execute or run your program Nested if - an if-elif-else construct inside another if-elif-else construct. Integrated Development Environment (IDE) – helps create While Loop - used to execute a block of statements programs and applications in diff programming languages. repeatedly until a given condition is satisfied. Indention – indicates groups or blocks of code The break Statement - stop the loop even if the while condition is true Program comment (#) – notes or reminders The else statement - run a block of code once when the condition no longer is true Printing Text – used to display output or text The continue Statement - stop the current iteration, .py – extension for python files and continue with the next For Loop - used for sequential traversal. >>> - prompt symbol of Python console The range () Function - To loop through a set of code Variable – an identifier or name for a reserved memory a specified number of times. location for storing values. Else in For Loop - specifies a block of code to be executed when the loop is finished. Python is dynamically-typed – the memory management for Lists - used to store multiple data at once. the variable will only be determined during runtime. Lists [ ]- A list is a collection of ordered data. Lists are mutable. Lists are declared with square braces. DATA TYPE – determines the kind of information that is stored in a variable Tuples ( ) - A tuple is an ordered collection of data. Tuples are immutable. Tuples are enclosed within parenthesis. Sets { } - A set is an unordered collection. Sets are mutable and have no duplicate elements. Dictionaries { }- A dictionary is an unordered collection of data that stores data in key-value pairs. Dictionaries are mutable and keys do not allow duplicates. Index – number associated with each item in a list. Slicing of a List – print(list[1:5]) Change Item Value in a list – list[index] = “name” 1. Using .append() 2. Using .extend() 3. Using del statement 4. Using .remove() 5. List length – len(list) Dictionaries are used to store data values in key:value pairs. Accessing item in Dictionary: dic() or .get() Changing the values in Dictionary: x=dic[key] = “value” or .update() Adding the values in Dictionary: dic[key]=”value” Removing the values in Dictionary: .pop()
FUNCTION – used to make codes reusable and readable