-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the example of usage of the SeriesResearch ADT
- Loading branch information
1 parent
c83b42a
commit 7b4df89
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |