title: What is 'good python code' and how can this meet the guidelines?
body: <p>I keep hearing about writing good code and writing bad code when you first start. Afterall, if it runs and gets the job done with 0 issues is that not enough? Can you use this as an example? I worked with what I knew and what I had to learn so I am sure it can be picked apart. Besides the PEP8 and stuff what is GOOD code? </p>
  
  <pre><code>import random
      def cownbull():
  """This one generates a non repeating random number"""
          def cownbull2():
      """This one is running the game due to local variable problems; keyboard 
                                                            almost thrown"""
              print(num2guess, 'is the generated number')
              print("Let's play a game of Cowbull!")  # explanation
              print("I will generate a number, and you have to guess the 
              numbers one digit at a time.")
              print("For every number in the wrong place, you get a cow. For 
              every one in the right place, you get a bull.")
              print("The game ends when you get 4 bulls!")
              print("There are no repeated digits")
              guesses = 0
              cow = 0
              bull = 0
              while True:
                  print("cows:", cow,'|','bulls:',bull,'|','guesses:',guesses)
                  cow = 0
                  bull = 0
                  user = input('Guess a four digit number: ')
                  if len(user) &gt;4:
                      print('type four digits!')
                      cownbull()
                  guesses = guesses + 1
  
                  for x in user:
                      for y in str(num2guess):
                          if x == y:
                              if user.index(x, 0, 4) ==
                                              str(num2guess).index(y, 0, 4):
                              bull += 1
                                  if bull == 4:
                                      print('Nice game!')
                                      cownbull()
                              else:
                                  cow += 1
                          else:
                              pass
          num2guess = random.randint(1000, 9999)
          count = 0
          while count &lt; 4:
              for i in str(num2guess):
                  count = count + 1
                  print(i)
                  str2guess = str(num2guess)
                  print(str2guess.count(i))
              if str2guess.count(i) != 1:
                  print('calculating new number....')
                  cownbull()
              else:
                  cownbull2()
  
  
  cownbull()
  </code></pre>