Question: Q1.What if, when calling a function of the form def func (a, b, c = 2) return a + b + c, do not specify
Q1.What if, when calling a function of the form
def func (a, b, c = 2)
return a + b + c,
do not specify the value of the argument c? (CHOOSE RIGHT ANSWER)
- it will default to 2
- It will take a random value
- Both of the above are correct
- None of the above
Q2.Suppose you define a tuple like the following: tup = (1, 2, 3, 4, 5)
Now you want to change the value of this tuple in the 2nd index to 10. Which of the following options would you choose? (CHOOSE RIGHT ANSWER)
- tup (2) = 10
- tup [2] = 10
- tup {2} = 10
- None of the above
Q3.Let's say you are given 2 lists - City_A and City_B.
City_A = ['1', '2', '3', '4']
City_B = ['2', '3', '4', '5']
Both cities have the same values. Which of the following codes will find the names of all cities that are present in "City_A" but not in "City_B".(CHOOSE RIGHT ANSWER)
- [i for i in City_A if i not in City_B]
- [i for i in City_B if i not in City_A]
- [i for i in City_A if i in City_B]
- None of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
