Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem # 2 : Volunteer Shifts You are volunteering for an event, and the event coordinator has divided all volunteers into shifts, which are all
Problem #: Volunteer Shifts
You are volunteering for an event, and the event coordinator has divided all volunteers into shifts, which are all numbered. The event coordinator has organized all of this using a simulated "spreadsheet", which is a string formatted like so:
Volunteer Name : Shift Shift #
Volunteer Name : Shift Shift #
The square bracket notation means that a particular string or number will be substituted there. Each shift number is either a onedigit or twodigit number. The In notation represents the newline character. We are using it to separate parts of the string from each other. Even though it consists of I and it's actually considered a single character!
Complete the function findvolunteershiftvolunteername, spreadsheet which reads in a volunteer's name, and returns the volunteer's corresponding shift, which should be an integer value Hint: use the int function. You may assume that a volunteer is only listed once in the spreadsheet string, and that they are assigned only to one shift.
If the volunteer name doesn't exist in spreadsheet, return
Example #:
findvolunteershiftTina 'Daniel: Shift InJane: Shift InTina: Shift In
George: Shift inJoe: Shift inStella: Shift ln
Return value:
Example #:
findvolunteershiftStella 'Daniel: Shift InJane: Shift InTina: Shift
Return value:
Example #:
findvolunteershiftAdam 'Daniel: Shift lnJane: Shift lnTina: Shift
George: Shift lnJoe: Shift inStella: Shift ln
Return value:
Example #: George: Shift : Shift Stella: Shift : Shift Kathy: Shift
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