1/24
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
what is a function?
a block of code which only runs when it is called. You can pass data, known as parameters, into a function. A function returns a value and a procedure just executes commands.
what is a procedure?
allows us to group a block of code under a name, known as a procedure name. We can call the block of code from anywhere in the program to execute
on the AP exam are procedure and function different?
no, procedure == function
what are parameters in a function?
The parameters to a function are the inputs to the function (what is being passed into the function).
what are arguments in a function?
_______ are the inputs to a function.
what are the 4 data types?
string, integer, float, boolean
what is try/except used for?
to try something except (ValueError)
what is the difference between print and return?
return - return a value to where you called it from. This can be useful for returning a value somewhere.
print - print just simply prints something, it doesn't return any values to the calling function.
what is local scope?
one that can only be seen, used and updated by code within the same scope. Typically this means the variable was declared (created) inside a function -- includes function parameter variables
what is a local variable?
A variable that is declared in the body of a method.
what is a global variable?
any variable defined outside all the functions in a program
what does floor division do?
This operator will divide the first argument by the second and round the result down to the nearest whole number
what does real division do?
has all of the decimals, the real number
what does modulus do?
gives the remainder
is random inclusive or exclusive?
inclusive
is for i in range inclusive or exclusive?
exclusive
what is scope?
A variable is only available from inside the region it is created.
what is the difference between = and ==?
The = is a simple assignment operator. It assigns values from right side operands to the left side operand. While on the other hand == checks if the values of two operands are equal or not.
what is a SENTINEL?
A sentinel is a special value that marks the end of a sequence of values.
what is the difference between display and print in python?
display - everything on same row
print - different rows
how do you stop a While True loop?
break
what does true AND false equal?
false
what does true OR false equal?
true
what is the hexadecimal number system?
1 2 3 4 5 6 7 8 9 A(10) B(11) C(12) D(13) E(14) F(15)
what is the difference between print and input?
Using the input() function, we take input from a user, and using the print() function, we display output on the screen