Python 101 Activity Scheduling


#1

Camp Sunny Daze has hired you as their new Activity Director. You are required to choose activities for the campers based on the weather predictions for that week. Given a list containing some number of integer values (each representing the average temperature for one day), your activities() function should return a corre- sponding list of strings representing daily activities. Your menu of possible activities, based on temperature, is as follows:
• 90 degrees or higher: swimming • 80–89 degrees: hiking
• 70–79 degrees: tennis
• 60–69 degrees: softball
• 50–59 degrees: football
• 49 degrees or below: movie
For example, if the day’s predicted temperature is 72 (degrees), that day’s activity will be tennis. Complete the schedule() function, which takes a list of positive integer values as its sole argument, and returns an equivalently-sized list of strings. Each string will match one of the activities listed above (in all lowercase), according to the value of the integer in that position in the parameter list (for example, if the first value in the input list is 61, the first value in the output list will be “softball”).

Function Call
schedule([72, 84, 55])
Return Value
["tennis", "hiking", "football"]
Function Call
schedule([95, 63, 70])
Return Value
["swimming", "softball", "tennis"]
Function Call
schedule([44, 56, 68, 92])
Return Value
["movie", "football", "softball", "swimming"]

I don't know how to write out the function please help !!!


#2

So are you planning to submit all your assignments for members to help with? I suspect your professor will not be impressed, unless this is what you've been directed to do. I don't have a good feeling about this. Could get you a fail if this is not allowed. Please advise.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.