title: Randomly getting none at end of list, python
body: <p>I am new to python and I am making a game in python I have two functions they are into different modules and when I call find_invotory() (show user's inventory), which uses a list to iterate over all the items in a list,  it randomly prints none at the end of the list, I have no idea why,</p>
  <p><em>Function 1:</em></p>
  <pre><code>def find_invontory():
    first_line = True
    invontory_lines = [&quot;ITEM              OWNED&quot;]
    store_items = [&quot;ATTACK UNITS&quot;, &quot;Infantry&quot;, &quot;Tank&quot;, &quot;Aircraft&quot;, &quot;Atomic Missle&quot;, &quot;Hydrogen Missle&quot;, &quot;DEFENCE UNITS&quot;, &quot;Defence Garrison&quot;, &quot;Land Mines&quot;, &quot;Anti Aircraft&quot;, &quot;Laser Cannon&quot;, &quot;DEFENCE BUILINGS&quot;, &quot;Walls&quot;, &quot;Fort&quot;, &quot;Turret&quot;, &quot;Bomb Shelter&quot;, &quot;-----------------&quot;]
    for item in store_items:
      if(item == store_items[0] or item == store_items[6] or item == store_items[11] or item == store_items[-1]): ### if statment so i dont all the collection funciton on my headers
        invontory_lines.append(item) 
      else:### calling the collection funciton with the object in list
        sps = &quot;&quot;
        CCmd = &quot;get_&quot; + item
        IG = collection(CCmd)
        number = len(item)
        while number &lt; 19:
          sps += &quot; &quot;
          number += 1
        invontory_lines.append(item + &quot;:&quot; + sps + str(IG))
    for line in invontory_lines:## print all the items in list
      print(Fore.BLUE,  line)
      if first_line: ### print enter after first line
        ent()
      first_line = False
  </code></pre>
  <p><strong>I am returning global variables</strong>,  <em>function 2:</em></p>
  <pre><code>def collection(var_needed):
    if var_needed == &quot;get_items_bought&quot;:
      return total_items_bought
    elif var_needed == &quot;get_money_spent&quot;:
      return money_spent
    elif var_needed == &quot;get_Infantry&quot;:
      return infantry
    elif var_needed == &quot;get_Tank&quot;:
      return tanks
    elif var_needed == &quot;get_Aircraft&quot;:
      return air_craft
    elif var_needed == &quot;get_Atomic Missle&quot;:
      return AM
    elif var_needed == &quot;get_Hydrogen Missle&quot;:
      return HM
    elif var_needed == &quot;get_Defence Garrison&quot;:
      return defence_troops
    elif var_needed == &quot;get_Land Mines&quot;:
      return land_mines
    elif var_needed == &quot;get_Anti Aircraft&quot;:
      return anti_aircraft
    elif var_needed == &quot;get_Laser Cannon&quot;:
      return Lcannons
    elif var_needed == &quot;get_Walls&quot;:
      if walls:
        return 1
      else:
        return 0
  </code></pre>
  <p>variables returning:</p>
  <pre><code>#### attack variables ###
  infantry = 0
  tanks = 0
  air_craft = 0
  AM = 0
  HM = 0
  ### Defence buildings ##
  walls = False
  fort = False
  turret = False
  bomb_shelter = False
  ### defence units ##
  defence_troops = 0
  land_mines = 0
  anti_aircraft = 0
  Lcannons = 0
  </code></pre>
  <p>Output:</p>
  <pre><code>ITEM              OWNED
  
  ATTACK UNITS
  Infantry:           0
  Tank:               0
  Aircraft:           0
  Atomic Missle:      0
  Hydrogen Missle:    0
  DEFENCE UNITS
  Defence Garrison:   0
  Land Mines:         0
  Anti Aircraft:      0
  Laser Cannon:       0
  DEFENCE BUILDINGS
  Walls:              0
  Fort:               0
  Turret:             0
  Bomb Shelter:       0
  -----------------
  None
  </code></pre>