CPSC230 Midterm
10 is what?
an integer
what is the difference between continue and break
continue - exits one iteration of loopbreak- exits entire loop
what is a float
decimal number
what is the difference between a complied and interpreted language
interpreted - produces a result from a program compiled- converted into machine code so that the processor can execute it
are strings mutable or immutable
immutable
pwd
tells you the full file path of where your terminal is looking for code
the start index is (inclusive/exclusive) and the stop index is (inclusive/exclusive)
the start index is inclusive and the stop index is exclusive
How do you check the type of variable? (float, string, etc.)
type()
what is a list in python
a container that stores a collection of elements that are arranged in a linear or sequential order
what compares the value or equality of objects
==
what is a string in python
A sequence of characters
indexing[_:_:_]
[start:stop:step]
newline
\n
tab
\t
what does if require
a boolean
what is the sign for does not equal
!=
what method returns True if all characters in the string are in the alphabet
.isalpha()
what method returns True if all characters in the string are digits
.isdigit()
what method returns True if all characters in the string are in lowercase
.islower
what method returns True if all characters in the string are in uppercase
.isupper
what method converts s string to lowercase
.lower()
what method enables users to replace one word or phrase with another
.replace
what method splits a string into a list using a user specified separator and/or whitespace if it isn't defined
.split()
what method returns true if the string starts with the specified value
.startswith()
what method removes any leading and trailing whitespaces
.strip()
what method converts a string to uppercase
.upper()
when counting number of letters in string, start at what number
0
Python is what type of language?
Interpreted
Computers are made up of billions of switches called
Switches
how do you reverse a string in python using slicing
[::-1]
how to print "Abby" from s1 = "My name is Abby"
print(s1[11:16]
what does immutable mean in python
when you cannot change the object type over time
What does a dictionary use
{:}
What does a set use
{}