Question: choose the correct answer Q10:Consider the function fun, which is defined below: def fun (x): x [0] = 5 return x There is a list
choose the correct answer
Q10:Consider the function fun, which is defined below:
def fun (x):
x [0] = 5
return x
There is a list with three numbers.
g = [10,11,12]
Which of the following will be the output of this print statement:
print fun (g), g
1- [5, 11, 12] [5, 11, 12]
2- [5, 11, 12] [10, 11, 12]
3- [10, 11, 12] [10, 11, 12]
4- [10, 11, 12] [5, 11, 12]
_____________________________
Q11:Suppose you are given a df data frame.
df = pd.DataFrame ({'Click_Id': ['A', 'B', 'C', 'D', 'E'], 'Count': [100,200,300,400,250]})
Now you want to change the column name "Count " in df to " Click_Count ". So, you wrote the following code to accomplish this step.
df.rename (columns = {'Count': 'Click_Count'})
What will be the result of the printout below?
print df.columns
1- ['Click_Id', 'Click_Count']
2- ['Click_Id', 'Count']
3- Print Error
4- None of the above
________________________________
Q12: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".
1- [i for i in City_A if i not in City_B]
2- [i for i in City_B if i not in City_A]
3- [i for i in City_A if i in City_B]
4- 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
