to encapsulate a string, will using single quotes be the same as using double quotes?
what will this output? (2_100)
Hello
how do you determine the length of a string?
if a string is provided with length k, can you access the kth character?
len()
no
what is the difference between them all?
int, float, str
what is the process of converting a variable of one predefined type into another?
provide a legal and illegal example
casting
what are the two arguements that a print function accepts?
sep= and end=
what will 9/5 return?
what will 9//5 return?
types are acceptable
1.8 (float)
1 (int)
What is the DRY principle and what is an advantage of utilizing it?
Don't Repeat Yourself
Avoids repetitive code
==
<
>
!=
<=
>=
after completing a step/activity, what should you always be doing?
Denoted as '%', this operator returns the remainder of a division operation.
modulus
List all variable types and scopes
What will be the output for each print statement?
2_300
global x, int | local x, string | global y, float
string | value x:3 | value y:3.0 | hello
what three three types of errors in python?
give an example of each one
semantic, syntax, runtime
what are the three/four commands of the typical git workflow? (in order)
git status (optional)
git add
git commit -m "..."
git push
Fail, Pass, Refactor
how do they differ?
what does the split() accept as an argument?
no
divides a string at the provided delimiter
a delimiter
list each command
- list all available drives
- change directory
- copy a file
- gdr
- cd
- cp
if you are importing a python file, that calls the main(), into a test file, what should you add at the end of the python file that you are testing?
if __name__ == "__main__":
main()
what the two main scopes in python?
local scope
global scope
what is the escape character?
using this character, how will you do the following:
tab
newline
backspace
single quotes
backslash "\"
\t
\n
\b
\'
When would you use each of the following: break, continue, pass
Use a break to get out of a loop.
Use continue to get out of conditional and continue the rest of the loop.
Use pass to ignore the rest of the loop.
Center is the origin.
Up is positive y-axis.
Right is positive x-axis.
what is an index?
the position of an token in an iterable sequence
string_one = "Hey"
string_one[2] == 'y'
string_one[-1] == ?
string_one[len(string_one)] == ?
define ranges(start, stop, k)
does ranges(5) == ranges(1,5)?
they do not equal.
how do these outputs differ? (5_500)
they are the same!