Python Forum
New to python, starting from scratch
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New to python, starting from scratch
The code is made to work with a specific amount of items in the list questions
The error happens because the list only has an item at index 0.
When it goes through the while True loop the first time n has the value 0.
questions[n] returns the first item of the list.
it continues to n += 1, n now has the value of 1.
It goes through the while True loop again and tries to call questions[n] to get the next item at index 1.
Because there isn't another item it gives the IndexError: list index out of range error.

Messages In This Thread
RE: New to python, starting from scratch - by Yoriz - Apr-16-2021, 01:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Kera Getting errors when following code example Image classification from scratch hobbyist 3 2,390 Apr-13-2021, 01:26 PM
Last Post: amirian
  starting python from windows command prompt MaartenRo 4 1,220 Sep-04-2020, 12:25 PM
Last Post: MaartenRo
  Restarting code from scratch palladium 1 883 Feb-29-2020, 04:46 PM
Last Post: ibreeden
  Issue starting Python on VSC (Nooby) Buggy 1 1,076 Mar-14-2019, 09:44 PM
Last Post: snippsat
  python 'SMTP debugging server' not starting local error pcsailor 1 1,862 Nov-26-2018, 10:13 PM
Last Post: micseydel
  Starting to learn python on a Mac asifhoss 8 6,115 Jan-03-2018, 08:29 PM
Last Post: karaokelove

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020