Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please show me the steps for questions 3 and 5. Thanks! Question 3 1 pts Okay, now we will actually make some meaningful data. Make
Please show me the steps for questions 3 and 5. Thanks!
Question 3 1 pts Okay, now we will actually make some meaningful data. Make a single assignment statement that would cause the variable days to have the correct result shown, where your statement has only one sign, only one+ sign, only one pair of brackets (DI) and only one comma (.). Once you have that single statement, place the portion that follows the into the answer box. L[31,30,31,30,31] daysfor you to fill in'"" days [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] Question4 2 pts So far we have seen how new lists can be built out of old lists using the addition and multiplication operators. This question will work with some other functions to do that. First copy or cut-and-paste this data (which is admittedly incomplete) months- ['Feb', 'Mar', 'Apr, 'May','3 un', 'Jul', 'Aug', 'Oct', 'Nov'] Then observe the effects of these statements months.append('Dec) months.insert (e, 'Jan') months And finally, for the question, identify how the insert function could be used to correctly place Sep' between 'Aug' and 'Oct If you happen to put it in the wrong place, you can undo the insertion with months.remove('Sep) months.insert(8, Sept') D Question 5 1 pts You may have noticed that these two lists (days and months) are related to each other. This relates to the title of today's activity-- Associative Data. If one wanted to figure out how many days were in a particular month, one could search the list of month names to find out where it appears, and then look in the corresponding position in the other list. Writing a search function in code uses language elements not yet covered in this course, but fortunately, Python lists have an index method that do the searching for us The syntax for the index method is very similar to the syntax for append in the previous question, so you can experiment with it to see how it works, and then use it to answer these questions: The first month (January) and its 31 days appear at position The last month (December) and its 31 days appear at position The fifth month (May) and its 31 appear at position in these lists
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started