Quiz 2 Data science

Name:
What does Shift+enter do in a Jupyter cell?
Run that cell
Takes us one cell up
Prints all code again
Doesn't do anything
What key do you hold down to do a multiple cursor selection in Python?
Shift
Alt
Ctrl
Fn
We can turn a float variable to a Boolean in Python by using the built-in function bool.
True
False
How do we slice this list mylist=['a',1,3,5,'b'] to give you [1,3,5]?
Mylist[1:3]
Mylist[1:4]
Mylist[2:4]
Mylist[2:5]
What would the following assert return?
number = -4
assert number > 0
False
Error
No output
None of the above
def strfn1(s): 
    if len(s) < 1:
        return s 
    s=s.lower()
    c = s[-1]
    s2 = s.replace(c,"*")[:-1]+c
    return s2
Given a string, replaces all the instances of the last char with *,keeping the last character as is.
Given a string, replaces all the instances of the last char including last char itself with *.
Given a string, puts a * next to all the instances of the last char.
None of the above
How do I return 'fff' from the following nested list? L = ['a', 'b', ['cc', 'dd', ['eee', 'fff']]]
L[2][2]
L[2][1]
L[2][2][1]
L[2][1][1]
Which line of code in the blank space would ensure that the function returns an uppercase string and the input list with 'apple' appended to it?
def myf1(s0, l0):
   s0 = s0.upper()
   .................
   return s0,l0
L0.append("apple")
L0=l0.append("apple")
Both
None of the above
The following statement when used to get an input from the user, might cause trouble. What kind of trouble is that and how do you handle it?
total = 0
n=[]
while (n != 0):
     n = int(input("Enter an int to sum, 0 to quit:"))
     total += n
NameError and you can use Try and Except to handle it.
ZeroDivisionError and you can use assert to resolve it
NameError and you can use Try and assert to handle it.
Value Error and you can use try and except to have user enter an integer.
{"name":"Quiz 2 Data science", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"Name:, what does Shift+enter do in a Jupyter cell?, What key do you hold down to do a multiple cursor selection in Python?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker