Terms Flashcards
What command will output what is in parenthesis?
print()
What command will output what is in parenthesis as an integer?
int()
What is the term for any decimal number?
float
What command will output what is in parenthesis as a float?
float()
What is the term for text?
string
What command will output what is in parenthesis as a string?
str()
What is the mathematical symbol for division?
/
What is the mathematical symbol for the remainder?
%
What is the mathematical symbol for exponents?
**
What is a comment?
any code that is ignored and does not affect the output
What symbol is placed in front of code that makes it a comment?
#
What is a term that is created and defined?
variable
What is a function?
A function is a section of code that is defined and can be called for later use under one command
How do you format the start of a function?
def functionName():
Everything in a function must be what?
indented
What is another way to say the instructions or set of commands for your function?
the function logic
How do you output a function?
Call it with the format functionName()
What are function parameters?
values or variables that are placed in the parenthesis of the function and must be defined before calling them
Where are function parameters placed?
def functionName(here):
When placing values to the function parameters, where are the values placed?
functionName(here)
returning a function is what?
getting a value back
you can update a variable in the same code because?
code is read from top to bottom
Why are functions useful?
you can use it over and over without having to copy and paste large sections of code
The order of the function parameters match what?
the order of the value
{0} is used as what?
a placeholder
What command is used to search code for a variable and output the value assigned?
.format()
When using return you must do what for it to output?
use print() then call the function for it to output
print(functionName())
If then statements are used in the format?
if:
elif:
else:
The elif command allows you to what?
chain together if statements to make one conclusion
When incorporation integers into if then statements what can you use?
> , <, <=, >=, and ==
When coding where does counting start?
at 0
lists are noted with what?
[]
when discussing lists, n is used to denote what?
the total number of items on the lists
index is used for what?
to denote a position on a list
what command finds the total number of items on a list?
len(listName)
When retrieving items from a list, what is the computer doing?
finding what item is in a certain position on the list
Loops are used for what?
to repeat a sequence of instructions until a condition is met
What is the format to begin a loop?
for index in range ( , ):
logic goes here
the end value on a loop range is?
non-inclusive