Question: Python questions 1. How many return statements is a Python function allowed tohave? a) 0 b) 0 or 1 c) 1 d) 1 or more
Python questions
1. How many return statements is a Python function allowed tohave?
a) 0
b) 0 or 1
c) 1
d) 1 or more
e) Any number
-----------------------------------------------------
2. Which statement best describes the effect of mystery onxs?
def mystery(xs):
for k in range(1,len(xs),2):
xs[k] = xs[k-1]
a) It duplicates the even-indexed elements of xs.
b) It duplicates the odd-indexed elements of xs.
c) It swaps adjacent elements of xs.
d) It copies the first element of xs into every other slot.
e) It copies the front half of xs into the back half.
-----------------------------------------------------------
3. In Python, the principal difference between a dictionary anda list is that
a) a list can store values of any type.
b) a dictionary stores values linearly.
c) a list accesses values by their position.
d) a dictionary validates entries before storing them.
e) a list can be mapped over
Step by Step Solution
3.51 Rating (164 Votes )
There are 3 Steps involved in it
1 Python progrm allows the user to use return statements when the programmer wants to ... View full answer
Get step-by-step solutions from verified subject matter experts
