Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q2 - Method II (1.25 points) is a built-in string method that returns a list of the words in the string. . count ( )
Q2 - Method II (1.25 points) is a built-in string method that "returns a list of the words in the string". . count ( ) is a built-in list method that "returns the number of times a specified value occurs in a tuple." You may wish to examine the contextual help for both methods to do this problem. In the cell below, the variable students_fruits has been provided for you. Using only and the methods split ( ) and (), generate the three variables specified at left in the bulleted list below, satisfying the following criteria: - apple_count | the number of times shows up in students_fruits - lychee_count | the number of times 'lychee' shows up in students_fruits - pineapple_count | the number of times 'pineapple' shows up in students_fruits Do not hard-code. Use your code to process the list so that we could change the list and you'd still generate the correct answer automatically. That is DON'T write something like: apple_count =5 Note you will have to execute the cell with the variable provided below before being able to reference it in your answer. \# these variables provided for you \# you will not be able to edit this cell students_fruits = 'apple apple apple banana pear dragonfruit starfruit apple pear pineapple apple grapefruit lime lyche print(students_fruits) apple apple apple banana pear dragonfruit starfruit apple pear pineapple apple grapefruit lime lychee plum plum pinea pple
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