DV Module 2 Functions & Operators Flashcards
What print is an example of a
Function name
Can you make your own functions in Python
Yes you can and the name should be significant to its use.
Anything thing between quotes will be taken literally, not as code but as_____.
Data which is string
A functions_name and a argument(s) forms a
function invocation
Steps the code takes to use a Function(argument)
- checks of the name is LEGAL]
- allows you to invoke; make sure there is the correct amount of functions.
- Leaves your code for a moment; jumps into the function you want to invoke.
- Executes its code; causes the desired effect
- returns to your code
Two ways you can create a newline or and emptyline
empty print() \n
Why would one use , in an argument?
To put more then one argument in the string
what is the keyword ‘end=’ used for
Code:
print(“My name is “, end=””)
print(“Monty Python.”)
to tell the code to keep the next argument on the same line of code.
Output:
My name is Monty Python.
what is keyword ‘sep=’ used for
Code:
print(“My”, “name”, “is”, “Monty”, “Python.”, sep=”-“)
sep = separator. it is used to choose what separate’s the argument’s
Output:
print(“My”, “name”, “is”, “Monty”, “Python.”, sep=”-“)
Can you mix more then one Keyword argument
yes you can mix keyword in one invocation
Explane a Literal
Data whose values are determined by the literal itself
Difference between an
Integers & Floats
Integers: devoid of fractional parts
Floats: Numbers that contain fractional parts
11111111 how is this different in python to 11_111_111
They are the same and underscores are the only way that Python allows you to make integers easier to read.
What symbols are used to represent an octal&hexadeciamal number
‘0o’ is used for octaldecimal numbers
‘0x’ is used for hexadecimal numbers
what abbreviation would one use to shorten a long number such as 2_0000_0000?
2 * 10e8 or 2 * 10E8
Exponent: value after E must be an integer
Base: before E may or may not be an integer