What do comments start with
a #
Lines of code can be categorized into three categories. What are they?
Input, processing, and output
Input statements
used to get data and pass it onto the program for processing
Processing Statements
Implement logic that is used to process the input and turn it into useful information
Output statements
used to display information on the screen
Algorithm
list of well defined computer instructions that can be used to solve a problem
program/source code/ code
List of statements that implement an algorithm using a programming language like python
variables
hold data that we can reuse in our program by writing the same variable name
Assignment Operator
right of the = is executed first, and result is assigned to the variable on the left
built in function to output data on the console
Debugging
process of finding bugs in your programs and sorting them out
Syntax Errors
language mistakes done by a programmer while writing code
Logic Errors
Algorithm that is used in the program is wrong.
String vs. Numbers
Strings include quotations, numbers do not
Rules for naming variables
consist of upper, lower letters, underscore, and numbers only
can only start with a letter or an underscore
case sensitive
cannot be the same as python reserved keywords
Strings
composed of one or more characters. Indicated by enclosing a value in single, double, or triple quotes
Escape Character “\”
changes the meaning of the character, appearing immediately afterwards
What can numbers be
Integers or Floating Point Numbers
Ints vs Float
Ints are whole numbers without a decimal point, floars have a decimal point
type
name of the built in function and we need to provide a variable as argument to this function
Typecasting
convert a value from one datatype to another datatype
What happens if you typecast a float into an integer
number is rounded down
What does input always read user data as
a string.
Formatted Output
Modifies the output according to the given pattern.
Multiline Strings
Triple Quotes
every program should have a __, and every expression should have a ____
statement, variable/literal
What is //
Floor Division Operator
What does // do
rounds float down to nearest whole number
How can you tell if it is a logical expression
uses and/or
what does ** do
exponent
What does / print
float
What does % print
int
Overflow
when a value is too large to be stored in the memory allocated by the interpreter