SHARE
TWEET

Untitled

a guest Oct 12th, 2017 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Ratings:
  2.     def __init__(self):
  3.         self.ratings = []
  4.  
  5.     def rate(self, rating):
  6.         self.ratings.append(rating)
  7.  
  8.     def average_rating(self):
  9.         length = len(self.ratings)
  10.         if length > 0:
  11.             return sum(self.ratings)/length
  12.         return 0
RAW Paste Data
Top