lab7finalpart

lab7finalpart - movie = [movie] organizedList = movie +...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
def movieReviews (tuples): reviews = tuples organizedList = [] movies = [] rating = [] for i in range (len(reviews)): movie = reviews[i] movie = [movie] organizedList = movie + organizedList organizedList.sort() print (organizedList) for i in range (len(organizedList)): movie1 = organizedList[i][0] movie1 = [movie1] movies = movies + movie1 ratings = reviews[i][1] ratings = [ratings] rating = ratings + rating print (movies) print(rating) dictionary = {} for i in range (len(movies)): dictionary[movies[i]]= rating[i] print (dictionary) def movieReviews1 (tuples): reviews = tuples organizedList = [] movies = [] rating = [] orgList = [] for i in range (len(reviews)): movie = reviews[i]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: movie = [movie] organizedList = movie + organizedList organizedList.sort() print (organizedList) def movieReviewsforReal(tuples): movieReviews = tuples dictionary={} secondDict = {} averageDict = {} for i in range(len(movieReviews)): dictionary[movieReviews[i][0]] = 0 secondDict[movieReviews[i][0]]=0 averageDict[movieReviews[i][0]]=0 for i in range(len(movieReviews)): secondDict[movieReviews[i][0]] = secondDict[movieReviews[i][0]]+1 dictionary[movieReviews[i][0]] = dictionary[movieReviews[i][0]] + movieReviews[i][1] for key in averageDict: averageDict[key] = dictionary[key]/secondDict[key] return averageDict...
View Full Document

This note was uploaded on 04/26/2011 for the course CPS 324 taught by Professor Safa during the Spring '11 term at Dickinson.

Page1 / 2

lab7finalpart - movie = [movie] organizedList = movie +...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online