From a697c864b44c6609a7c4ee7d36da687ffbaee4d5 Mon Sep 17 00:00:00 2001 From: "Thomas Cradock (cradockt)" Date: Sat, 28 Nov 2020 13:51:21 +0000 Subject: [PATCH] Forgot to add ID number and such --- artistrecommend.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/artistrecommend.py b/artistrecommend.py index 5274def..0989a2d 100644 --- a/artistrecommend.py +++ b/artistrecommend.py @@ -1,4 +1,4 @@ -#to allow the user to input an artist and genre, then reccomend other artists from that genre +#Code by Thomas Cradock 10370302 def artistPref(): rockArtists = [ @@ -83,10 +83,11 @@ def artistPref(): "kaiser chiefs" ] - +#lists for each music genre containing artists of that genre pref = input ("Please enter an artist you like to listen to\n").lower() genre = input("Please enter the genre of the artist you provided\n").lower() +#takes the user inputs for an artist they like and the genre of the artist so it can focus on what genre to look at if genre == "rock": print("I would reccommend:\n") @@ -95,7 +96,10 @@ def artistPref(): continue else: print(artist) - +#if statement checks the input that the user enter for the genre, then outputs the list of artists from that genre. +#for loop iterates through each element in the list to check if its the same as the artist the user entered +#if it was, it is not printed for the user to see +#if it was not, the element is printed elif genre == "metal": print("I would reccommend:\n") @@ -151,7 +155,7 @@ def artistPref(): else: print("I do not understand that genre, please try again") artistPref() - +#generic else statement for if the user input for the genre does not match one of the specified ones artistPref()