While loops - ANSWER -executes a series of steps while some condition is
true
-the test (part between the parentheses) returns either true or false
-loop continues until the test returns false
-while loops are used when we don't know how many times we need to repeat
the steps... it relies on an external condition
Ex: while (there are still lines in a file)
read the next line
print the line out
For Loops - ANSWER - executes a series steps of steps a finite amount of
times-text evaluates a counter, when it reaches the last value, the loop stops
repeating-we use a for loop when we know ahead of time how many times, we
need to repeat the stepsEx: for (count = 1 to 12)do a stepdo another stepincrease
the count by one
print() - ANSWER a built-in function to display on screen in Python
String - ANSWER set of characters represented in quotation marks
int(x) - ANSWER to convert x to a plain integer
float(x) - ANSWER to convert x to a floating-point number.
Variables - ANSWER are assigned values using the '=' operator, which is not
to be confused with the '==' sign used for testing equality. A variable can hold
almost any type of value such as lists, dictionaries, functions.
Ex: >> x = 12 12
Functions - ANSWER Python builds ___ using the syntax:
def function_name(variable): Functions can be stand-alone or can return values.
Functions can also contain other functions.
Ex: def add_two(a, b): c=a+b
true
-the test (part between the parentheses) returns either true or false
-loop continues until the test returns false
-while loops are used when we don't know how many times we need to repeat
the steps... it relies on an external condition
Ex: while (there are still lines in a file)
read the next line
print the line out
For Loops - ANSWER - executes a series steps of steps a finite amount of
times-text evaluates a counter, when it reaches the last value, the loop stops
repeating-we use a for loop when we know ahead of time how many times, we
need to repeat the stepsEx: for (count = 1 to 12)do a stepdo another stepincrease
the count by one
print() - ANSWER a built-in function to display on screen in Python
String - ANSWER set of characters represented in quotation marks
int(x) - ANSWER to convert x to a plain integer
float(x) - ANSWER to convert x to a floating-point number.
Variables - ANSWER are assigned values using the '=' operator, which is not
to be confused with the '==' sign used for testing equality. A variable can hold
almost any type of value such as lists, dictionaries, functions.
Ex: >> x = 12 12
Functions - ANSWER Python builds ___ using the syntax:
def function_name(variable): Functions can be stand-alone or can return values.
Functions can also contain other functions.
Ex: def add_two(a, b): c=a+b