Question: Need help with the following 4 Python questions, please provide python code if applicable. For Q7, I recieved 3/4 points and choosing just option d)
Need help with the following 4 Python questions, please provide python code if applicable.
For Q7, I recieved 3/4 points and choosing just option d) but is a, b or c also correct?
For Q8, I recieved 2/4 points and chose option b) and d) only but is only one correct?
For Q10, no idea what it is
For Q11, I have a pretty good idea its supposed to be 4,1,3,2 respectively instead of 4,2,3,1 (the 1 and 2 need to be swapped). Am I right?
Please provide a good explanation along with the code. thanks.

Question 7 3 / 4 points Jane has a shopping list as follows: shopping_list = ['milk', 'bread'; 'banana" coffee', 'egg' 'pasta"] Jane realized she needs apples instead of bananas, plus adding cheese and mushrooms to the list. Which of the following code snippets replace the banana with apple and add cheese and mushroom as two separate strings to the end of the shopping list? Hint: The output should be as follows: ['milk', 'bread', 'apple', 'coffee', 'egg', 'pasta', 'cheese', 'mushroom"] Note: This is a Multi-Select question. Select all that apply. shopping_list [2] = "apple" shopping_list. append ( ("cheese", "mushroom") ) shopping_list [shopping_list. index("banana" ) ] = 'apple' shopping_list. append ( ["cheese", "mushroom"] ) shopping_list [shopping_list. index( "banana" ) ] = 'apple' shopping_list. extend( ["cheese", "mushroom"] ) shopping_list [2] = "apple" shopping_list. extend( ("cheese", "mushroom" ) ) Question 8 2 / 4 points Which of the following code snippets prints the dictionary's values rather than printing its keys? Note: This is a Multi-Select question: Choose all that apply. months = {'Jan' : 1, 'Feb': 2, 'Mar' : 3} for m in months: print (m. items () , end = ' ') months = {'Jan' : 1, 'Feb ': 2, 'Mar' : 3} for m in months: print (months [m] , end = ' ' ) months = {'Jan' : 1, 'Feb' : 2, 'Mar': 3) for m in months: print (m, end = ' ') months = {' Jan' : 1, 'Feb' : 2, 'Mar": 3} for m in months: print (months. get(m), end = ' ') Question 10 2 / 4 points Which of the following Python expressions is an equivalent to this mathematical formula x + 2y + 2y Note: This is a Multi-Select question: Choose all that apply. (x + 2 * y) *+ 2+x/ (2 * y) "+ 0.5 ( (x + (2 * y)) * * 2) + ((x / (2 * *) ) * * ( 1 / 2) ) ( x + 2 * y ) * 2 + (x / 2 "y) * * (1 / 2 ) ( (x + 2y) * 2 + math.sqrt(x / 2y) Question 11 2 / 4 points Let a = ['P; 'Y, 'T, 'H. 'O', 'N'] Match each of the following commands with its equivalent that returns the same output. 4 _ a[-3:3] 1. a[1:3] 2__ a[-5:-3] 2. a[1:4:2] __3__ a[-6:-3] 3. a[:3] _1__ [a[1],a[3]] 4. a[3:-3]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
