Question
Start by assigning to variable answers a list containing an arbitrary sequence of strings 'Y' and 'N'. For example: answers= ['Y','N','N','Y','N','Y','Y','Y','N','N','N'] Write Python statements corresponding
Start by assigning to variable answers a list containing an arbitrary sequence of strings 'Y' and 'N'. For example:
answers= ['Y','N','N','Y','N','Y','Y','Y','N','N','N']
Write Python statements corresponding to the following: (a) assign to variable numYes the number of occurrences of 'Y' in list answers. (b) assign to variable numNo the number of occurrences of 'N' in list answers. (c) assign to variable percentYest the percentage of strings in answers that are 'Y'. (d) sort the list answers. (e) Assign to variable f the index of the first occurrence of 'Y' in sorted list answers.
thank you in advance
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