Programming Language — Understood both by a programmer and computer.
Common language used to wrote solutions.
Ways to Express an Algorithm (but not limited to):
Paragraph
Bulleted List
Flowchart
Python Language — High level (closer to human level), general-purpose, interpreted (reads code line by line), dynamic (lines can be executed while program is running), programming language.
Use .2f for decimal, use /n for new line.
Algorithms should be monitorable -- that is, at any point in an algorithm, we should be able to know what’s happening inside.
Programming Environment — The app wherein the program is made.
Variables — Named containers.
Programmers get to name the variables.
Contents are changeable in later statements.
Contains value of content to remember.
Rules in Naming a Variable:
Must start with a letter or underscore.
Cannot contain special symbols except for an underscore.
Can have numbers, but not start with them.
Cannot use python keywords or reserved words.
Cannot have any whitespaces
Variables are case sensitive.
Assignment Operator (=) — Assigns a value (left-hand side) to a variable (right-hand side.
Assignment Statement — The entire line of code.
Post-Processing – State of an algorithm (happening in a certain point of the algorithm)
Data Types:
String — Enclosed with two double quotes.
Integer- and float-applicable variables can also be enclosed in strings, so make sure to review the code carefully!
Integer — Preferable for containers that use whole numbers.
Float — Utilizes decimals for certain variables.
Boolean (True or False).
George Boolean — Father of the digital age, English mathematician, philosopher and logician.
Provided the mathematical and logical foundation of computers.
Involves the use of only 2 values, yes or no, true or false, 1 or 0.
It also makes use of propositions and logical operators.
Operators in Python (PEMDAS Structure):
Addition: +
Subtraction: -
Multiplication: *
Division: /
Integer/Floor Division: # or //
Modulo (Remainder): %
Operator Precedence:
Positive and negative (unary operators) always take the highest precedence.
Divisions (/) will always result in a float data type.
All other operations will result in a float if one of the integers is a float.
This specifically includes the floor division and modulo remainder.