-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopulate.py
43 lines (35 loc) · 1.81 KB
/
populate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from TomeRater import *
Tome_Rater = TomeRater()
#Create some books:
book1 = Tome_Rater.create_book("Society of Mind", 12345678)
novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345)
novel1.set_isbn(9781536831139)
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452)
nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938)
novel2 = Tome_Rater.create_novel("The Diamond Age", "Neal Stephenson", 10101010)
novel3 = Tome_Rater.create_novel("There Will Come Soft Rains", "Ray Bradbury", 10001000)
book3 = Tome_Rater.create_book("The Collective Works of C. G. Jung", 12345678)
#Create users:
Tome_Rater.add_user("Alan Turing", "[email protected]")
Tome_Rater.add_user("David Marr", "[email protected]")
#Add a user with three books already read:
Tome_Rater.add_user("Marvin Minsky", "[email protected]", user_books=[book1, novel1, nonfiction1])
Tome_Rater.add_user("David Marr", "[email protected]")
#Add books to a user one by one, with ratings:
Tome_Rater.add_book_to_user(book1, "[email protected]", 1)
Tome_Rater.add_book_to_user(novel1, "[email protected]", 3)
Tome_Rater.add_book_to_user(nonfiction1, "[email protected]", 3)
Tome_Rater.add_book_to_user(nonfiction2, "[email protected]", 4)
Tome_Rater.add_book_to_user(novel3, "[email protected]", 1)
Tome_Rater.add_book_to_user(novel2, "[email protected]", 2)
Tome_Rater.add_book_to_user(novel3, "[email protected]", 2)
Tome_Rater.add_book_to_user(novel3, "[email protected]", 4)
#Uncomment these to test your functions:
Tome_Rater.print_catalog()
Tome_Rater.print_users()
print("Most positive user:")
print(Tome_Rater.most_positive_user())
print("Highest rated book:")
print(Tome_Rater.highest_rated_book())
print("Most read book:")
print(Tome_Rater.get_most_read_book())