title: TypeError: can only concatenate list (not "int") to list. Error occurs when assigning 2 variables to one variable
body: <p>I am making a password generator using a class called <code>password</code> and a 2 functions called <code>generate_memorable</code> (generates a passwords that can be easily remembered) and <code>generate_intricate</code> which will generate a complex password.</p>
  <p>My Code:</p>
  <pre><code>import random
  import urllib.request
  import string
  
  class password:
      def __init__(self, length):
          self.length = length
  
      def generate_intricate(self, iterations):
          characters = string.ascii_letters + string.digits + string.punctuation
          for p in range(iterations):
              output_password = ''
              for c in range(self.length):
                  output_password += random.choice(characters)
              print(output_password)
  
      def generate_memorable(self, iterations):
          # get some random words
          word_url = &quot;http://svnweb.freebsd.org/csrg/share/dict/words?view=co&amp;content-type=text/plain&quot;
          headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'}
          req = urllib.request.Request(word_url, headers=headers)
          response = response = urllib.request.urlopen(req)
          long_txt = response.read().decode()
          words = long_txt.splitlines()
  
          output_password = ''
  
          # generate the number of password specified
          for i in range(iterations):
              while len(output_password) != self.length:
  
                  # generate a random number with a length of 3 to 5
                  for i in range(random.randint(3, 5)):
                      numbers = random.randint(1, 9)
  
                  # the ouput password is equal to the words from the world_url and numbers put together
                  output_password = words + numbers # THIS IS WHERE THE PROBLEM IS OCCURING
  
                  # im trying to make sure that the length of the generated password is equal to the length specified by the user
                  if len(output_password) &gt; self.length: # if length of password is larger than length specified
                      difference = len(output_password) - self.length # difference between output password and length specified
                      print(output_password[: -difference]) # print the output password minus the difference.  
  
                  elif len(output_password) &lt; self.length: # if length of output_password is smaller than length specified
                      difference = self.length - len(output_password) # difference = length specified - length of output_password
                      print(output_password,output_password[: difference]) # print output_password + difference characters from output_password. 
  
                  elif len(output_password) == self.length: # if length of output_password = length specified
                      print(output_password)
  
  # Test
  password1 = password(20) # password length = 20
  password1.generate_memorable(3) # generate a memeorable password (containing words and numbers) 3 times
  </code></pre>
  <p><strong>My Problem</strong></p>
  <p>When I run the program, I get the following error:</p>
  <pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
    File &quot;C:\Users\sbenf\OneDrive\Python Projects\Large Projects\Adventure_Colussus_Game\passwordtest.py&quot;, line 55, in &lt;module&gt;
      password1.generate_memorable(3) # generate a memeorable password (containing words and numbers) 3 times
    File &quot;C:\Users\sbenf\OneDrive\Python Projects\Large Projects\Adventure_Colussus_Game\passwordtest.py&quot;, line 37, in generate_memorable
      output_password = words + numbers # THIS IS WHERE THE PROBLEM IS OCCURING
  TypeError: can only concatenate list (not &quot;int&quot;) to list
  </code></pre>
  <p>I have no idea what to do so I was wondering if someone could point me in the right direction.</p>