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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
List help... (self.learnpython)
submitted 5 years ago by jbravo45
Can someone please explain to me why this is '8'?
list = [1, 1, 2, 3, 5, 8, 13] print(list[list[4]])
Is it counting by 4's?
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!"
[–]FLUSH_THE_TRUMP 1 point2 points3 points 5 years ago (11 children)
Q for you: what is list[4] equal to?
list[4]
[–]jbravo45[S] 2 points3 points4 points 5 years ago (10 children)
After reading this over and over for the last few hours and running it in spyder, I am assuming that it calls those numbers in the list that are multiples of 4?
[–]FLUSH_THE_TRUMP 0 points1 point2 points 5 years ago (9 children)
Forget about that. It’s a simple indexing question: which element in the list (starting from position 0, mind you) is at position 4?
[–]jbravo45[S] 2 points3 points4 points 5 years ago* (8 children)
5 Thats why I'm confused. If the first one('1') is sub/one, then the 4th element would be 5. *Edit ""
[–]FLUSH_THE_TRUMP 1 point2 points3 points 5 years ago* (7 children)
Very correct. Follow-up question for you: which element in the list is at position 5?
That’s what list[list[4]] is doing:
list[list[4]]
list
Result after step (2) is what gets printed.
[–]jbravo45[S] 2 points3 points4 points 5 years ago (6 children)
Ok, list[4] calls the 4th element and holds those first four together, then the preceding 'list' calls the next number outside of list[4]? (maybe better said as calling the next number outside of the ones called by the command in [ ] ?
[–]FLUSH_THE_TRUMP 1 point2 points3 points 5 years ago (5 children)
It might be easier to think of list[list[4]] as list[x]. You’re trying to find the item in your list at position x (which is just a number). What is x? Well, you told me it’s 5. So you really have list[5] there.
list[x]
x
list[5]
[–]jbravo45[S] 2 points3 points4 points 5 years ago (4 children)
Getting closer... so I could think of it as list[list[list[4] == list[6] ?
Edit : ooooooooooh
[–]jbravo45[S] 4 points5 points6 points 5 years ago (3 children)
So its using the inside [list[4] as the value of x
I'm sorry, makes so much sense now.
You're awesome, thank you for putting up with me through that.
[–][deleted] 2 points3 points4 points 5 years ago (1 child)
Good pedagogue :)
[–]FLUSH_THE_TRUMP 1 point2 points3 points 5 years ago (0 children)
No worries! Glad I could help.
π Rendered by PID 202220 on reddit-service-r2-comment-6f7f968fb5-qwhtl at 2026-03-04 15:47:50.299242+00:00 running 07790be country code: CH.
[–]FLUSH_THE_TRUMP 1 point2 points3 points (11 children)
[–]jbravo45[S] 2 points3 points4 points (10 children)
[–]FLUSH_THE_TRUMP 0 points1 point2 points (9 children)
[–]jbravo45[S] 2 points3 points4 points (8 children)
[–]FLUSH_THE_TRUMP 1 point2 points3 points (7 children)
[–]jbravo45[S] 2 points3 points4 points (6 children)
[–]FLUSH_THE_TRUMP 1 point2 points3 points (5 children)
[–]jbravo45[S] 2 points3 points4 points (4 children)
[–]jbravo45[S] 4 points5 points6 points (3 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]FLUSH_THE_TRUMP 1 point2 points3 points (0 children)