0

I’m trying to create an anime suggestion algorithm to help me learn python but i ran into a problem. So when I run the program it just prints out a random sample from the animemovies variable which holds a csv of anime movies even though i might pick (S) for animeseries or (O) for animeother which hold their respective csv files, I've double checked the csv files and even printed the separately to confirm that all the variables link to different file so im pretty sure it a problem with a loop i even switch the placement for animemovies and series in the if statement and all that cam out from then on were series, the program is ignoring the other if statements does anyone know how to fix this?


        # Here is the problem because no matter what option they choose it suggests a movie (you'll have to remove the
        
        if r1 == 'M' or 'm':
            r1 = animemovies
            break
        elif r1 == 'S' or 's':
            r1 = animeseries
            break
        elif r1 == 'O' or 'o':
            r1 = animeother
            break
        else:
            print('NANI!??\nINVALID INPUT!!!\nBAKA!')
            continue
    lis = r1[r1['genre'].isin([r2])]...  
Rick Sky
  • 3
  • 2
  • @Grismar That someone was the OP, as they edited their question and ticked the "Submit for review" checkbox (this can be seen in the [revision history](https://stackoverflow.com/posts/73429025/revisions)) – Mark Rotteveel Sep 12 '22 at 08:03
  • @MarkRotteveel thanks for pointing that out - I hadn't realised the reopen comment would show up in the revision history (but of course that makes a ton of sense). – Grismar Sep 12 '22 at 22:01
  • @RickSky You said "the question that my question was linked to did not answer my question" - did you realise that the issue in both your question and the linked on is a misunderstanding of how `r1 == 'M' or 'm'` should really be `r1 == 'M' or r1 == 'm'`, or perhaps `r1 in ['m', 'M']` or even `r1.lower() == 'm'`? Once you fix that in your code, do you still have a question? If so, please ask. – Grismar Sep 12 '22 at 22:03
  • @Grismar ohhhhhhhh im so sorry for the inconvenience i didn't pick up on that at the time ill try it when I'm done with my current project but I'm sure it will work. Thank you. – Rick Sky Oct 02 '22 at 20:41

0 Answers0