168k views
2 votes
mins_by_phone(phone): calculate and return the number of call minutes associated with the given phone line in this plan based on

User Jroyce
by
4.7k points

1 Answer

2 votes

Answer:

def mins_by_phone(phone):

if phone in self.phones:

min_sum = 0

for call in calls:

min_sum += call

return min_sum

else:

return 0

Step-by-step explanation:

The mins_by_phone function above is the Phone class method. It checks for the presence of the argument value in the self.phones instance variable, which is a list and sums up and returns the call minutes in the call list.

User Steve Zavocki
by
4.7k points