Last active
May 4, 2019 18:33
-
-
Save aurorapar/cc5eb000624d25c3e157a2a002ee70e8 to your computer and use it in GitHub Desktop.
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
yearOne = 0 | |
yearTwo = -1 | |
def getYears(): | |
global yearOne, yearTwo | |
prompt = "Enter the years you would like movies for: " | |
yearOne = input(prompt) | |
while "int" not in yearOne: | |
print("You didn't enter a year.") | |
yearOne = input(prompt) | |
yearTwo = input(prompt) | |
while "int" not in yearTwo: | |
print("You didn't enter a year.") | |
yearTwo = input(prompt) | |
getYears() | |
while yearOne < yearTwo: | |
print("The first year should be less than the second.") | |
getYears() | |
movies = {} | |
with open("info.txt", "r") as movieDB: | |
movie, genre, year = (movieDB.readline(), movieDB.readLine(), movieDB.readLine() | |
if year not in movies: | |
movies[year] = [] | |
movies[year].append((movie, genre)) | |
print("%s-%s"%(yearOne, yearTwo)) | |
for year,movie in movies.items(): | |
if yearOne <= year and year <= yearTwo: | |
print("\t%s"%movie[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment