i want to recommend movie

if user input genre/type of movie they will show title of movie and rating
i want to know how to write
i'm doing if they input genre that same in list_in(genre of movie) they will collect in the same list(genre[])

You are viewing a single comment. View All

Some first thoughts:

  • Whenever you have a lot of repetitive code, it's time to consider loops and functions.
  • Line 5: str(input()) is redundant, as input() always returns str.
  • Line 7: genre = [] must go before the if statement.
  • Asking for the genres's name is error-prone.

My approach would involve a dictionary of number --> genre.
The input is so much simpler then, more so if you ask for multiple genres.

So much for now, HTH


I see you improved your code. Nice job, works fine!

I thought about the error-prone entering of genres and came up with a multiple choice module:

If you want to use it, remember that it always returns a list, even if there is only one option chosen.



thank for your suggestion so much help me for my [email protected]


i want to show type of movie for movie to user to choose
but my type of movie have too much how do i write? @Codejira


I didn't know this was homework.
You should do most of it by yourself ;-)

If I get you right, you need to show more genres on one screen page?
I will think about it and improve the module.
Look out for it.

I recommend printing your genres in columns.
Unfortunately there is no built-in function, so you have to figure it out for yourself.
Soon you will be able to get inspiration from my choice module.


So this is what I made it look like


thank you so much for help me but i run your code choose_multiple that not be found i can't run program @Codejira


@withPinkkkyy I hope I understand you correctly.

If you don't see the files, find the document icon to the left. It says "Files" when the mouse pointer hovers over it. Click it to show the repl's files.

Click on the file columns.py to show the example code and learn how to use the module on your data.
Click on the file choose_multiple.py to show the code of the actual module.
Click on the file readme.md to show a formatted explanation / documentation.


i mean i run your code choose_multiple in orther program
it can't run @Codejira


@withPinkkkyy Oh, I see!
I can only guess what you are doing exactly, but this should work:

  • Go to my repl, open choose_multiple.pyand copy all the code.
  • Go to your repl, create a new file, name it choose_multiple.py and paste the code into it.
  • Open your file main.py and at the top add the line
    from choose_multiple import choose_multiple
  • Look into my readme.md or columns.py to learn how the module is to be used.

I just ran your program and noticed that you are importing matplotlib and numpy. They aren't used, are they? You better delete these imports then.


thank! u can run my program now ,i import matplotlib and numpy.
for make plot i must make plot this program @Codejira


in your choose_multiple.pt did you use dict or not
i am learning about your code @Codejira


@withPinkkkyy Yes,there is a dict. It's just not obvious, as I took a short cut. Inspect line 42:
option = {num+1:opt for num, opt in enumerate(from_list)}

  • the new dict is called `option'
  • num+1:opt are the key:value pairs, with num starting at 0, but I want 1 as first key.
  • (num, opt) is a tuple returned by enumerate(). See documentation.

The notation with the curly brackets is called dict comprehension. It is a short cut for

Note: Looking at the documentation link above I just learned that enumerate has an optional start parameter, preferable to num+1.

Tip: Also look into list comprehension. A cool thing to have in your toolbox.


Thank you for sharing. You can experience Rokkr, an application to watch TV and dramas that you will enjoy here: https://rokkrplus.com/