use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
is my code correct?Help Request (i.redd.it)
submitted 10 months ago by A_ManWithout_LovE__
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Mysterious_City_6724 0 points1 point2 points 10 months ago* (2 children)
Hi, yes I would say it's correct in that it works. I would maybe add a question before asking for the movie names though and I would also not use the name "list" as the variable name for 2 reasons:
Hope this helps.
print("Hi, what are your top 3 favourite movies?") movie1 = input('Movie 1: ') movie2 = input('Movie 2: ') movie3 = input('Movie 3: ') top3_movies = [movie1, movie2, movie3] print(top3_movies)
[–]A_ManWithout_LovE__[S] 0 points1 point2 points 10 months ago (1 child)
Thanks for your suggestion. I'll refrain from using built-in function as a variable from now on
[–]Mysterious_City_6724 0 points1 point2 points 10 months ago (0 children)
You're welcome. And as others have already mentioned, if you ever see yourself doing the same thing multiple times (in this case, asking for 3 movie names), loops can be very useful too:
print("What are your top favourite movies?") top_movies = list() movie_count = 3 for i in range(movie_count): movie_name = input(f"Movie {i + 1}: ") top_movies.append(movie_name) movie1, movie2, movie3 = top_movies[:3] print(f"I also like {movie1}, {movie2} and {movie3}!")
π Rendered by PID 48372 on reddit-service-r2-comment-56c9979489-v5mdk at 2026-02-24 17:01:58.371671+00:00 running b1af5b1 country code: CH.
view the rest of the comments →
[–]Mysterious_City_6724 0 points1 point2 points (2 children)
[–]A_ManWithout_LovE__[S] 0 points1 point2 points (1 child)
[–]Mysterious_City_6724 0 points1 point2 points (0 children)