This may be an easy fix, but I am just getting into lists and def functions and am really confused why the second input inside of the range function doesn’t show up at all when I run the program.
Your first problem is on line 3, which I’m not entirely sure what you’re talking to accomplish. len(some_list)
tells you the current length of the list, it isn’t possible to assign to that to change the size of the list or something. Currently you’re using ==
, which actually just checks if the length is equal to the provided value (but then throws away the result because you’re not doing anything with it). You probably want to be saving the result into a third variable.
The reason the for loop is doing nothing is because the input()
line didn’t change the list, so it’s still empty. len(treasures) + 1
is 0 + 1
which is of course 1. The way range()
works is that it starts at the first start value, then goes up to but does not include the end value. range(1, 1)
is actually entirely empty, so the for loop runs zero times.
Thank you sorry I am very new
Please don’t post screenshots.
Copy and paste any code or traceback, and in order to preserve formatting, select the code or traceback that you posted and then click the </>
button.
Nothing to be sorry about; everyone’s new at some point.
But please paste text into your post instead of a screenshot. Example:
```
some code
goes here
```
There’s a </>
button in the compose bar for this.