So I am rather new to programming and just recently started with Classes and we are supposed to make a phonebook that can be loaded in seperate text files.

I however keep running into the problem in this section that when I get into the for-loop. It hits a brick wall on

```
if storage[2] == permaStorage[i].number:

```

And tells me "IndexError: list index out of range". I am almost certain it is due to permaStorage starts out empty, but even when I attempt to fill it with temporary instances of Phonebook it tells me it out of range. The main reason it is there is to check if a phone number already exists within the permaStorage.

Anyone got a good tip on how to solve this or work around it?

(Sorry if the text is badly written. Just joined this site and not sure on the style)

```
class Phonebook():
  def __init__(self):
      self.name = ''
      self.number = ''

def Add(name1, number1):
  y = Phonebook()
  y.name = name1
  y.number = number1
  return y

def Main():
  permaStorage = []
  while True:
      print " add name number\n lookup name\n alias name newname\n change name number\n save filename\n load filename\n quit\n"
      choices = raw_input ("What would you like to do?: ")
      storage = choices.split(" ")
      if storage[0] == "add":
          for i in range(0, len(permaStorage)+1):
              if storage[2] == permaStorage[i].number:
                  print "This number already exists. No two people can have the same phonenumber!\n"
                  break
              if i == len(permaStorage):
                  print "hej"
                  try:
                      tempbox = Add(storage[1], storage[2])
                      permaStorage.append(tempbox)
                  except:
                      raw_input ("Remember to write name and phonenumber! Press any key to continue \n")

```