From 7b4df8959babdc963d5489f89801f911598edb80 Mon Sep 17 00:00:00 2001 From: victoria-yuzkiv Date: Sat, 13 May 2017 23:36:10 +0300 Subject: [PATCH] Add the example of usage of the SeriesResearch ADT --- ...mple of usage of the SeriesResearch ADT.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/examples/Example of usage of the SeriesResearch ADT.py b/examples/Example of usage of the SeriesResearch ADT.py index e69de29..2e01a20 100644 --- a/examples/Example of usage of the SeriesResearch ADT.py +++ b/examples/Example of usage of the SeriesResearch ADT.py @@ -0,0 +1,35 @@ +from modules.series_research import SeriesResearch + + +def example(): + """ + The example of usage of the SeriesResearch ADT. + """ + # Creates a new array (length = 2) + new_array = SeriesResearch(2) + + # Sets values to each element of the array. + new_array.set_item(0, "Sherlock") + new_array.set_item(1, "Doctor Who") + + # Gets values and prints it. + print("Item 0 = ", new_array.get_item(0)) + print("Item 1 = ", new_array.get_item(1)) + + # Gets lists of actors. + actors0 = new_array.get_actors(0) + actors1 = new_array.get_actors(1) + + # Prints these lists. + print(actors0) + print(actors1) + + # Finds the number of seasons in series. + seasons0 = new_array.seasons_number(0) + seasons1 = new_array.seasons_number(1) + + # Prints the number of seasons. + print("The number of seasons in", new_array.get_item(0), ":", seasons0) + print("The number of seasons in", new_array.get_item(1), ":", seasons1) + +example()