I am fairly new to Python, and I am currently using Python 3.3.3 just in case you were wondering. Below is my code, which I translated from whatever language Batch Script is written with, to Python. Here is the Batch Script code. I don't know what I am doing wrong, but when I run this, I get NameError: global name 'change' is not defined. I used http://pych.atomidata.com/code to check the syntax, and if you input my Python code into the box to check it, all you get is a couple code errors, and some Pep-8 errors. I can't think of what else is wrong. I don't even know what most of the code errors are, and the Pep-8 errors are all Line: __ Column: __ E302 expected 2 blank lines, found 1. 
import subprocess as sp
global change
global count
def numberInput():
    while True:
        try:
            number = int(input("Input a number, please: "))
            sp.call('cls', shell=True)
            break
        except ValueError:
            print('Please enter a valid input...')
            sp.call('pause', shell=True)
            numberInput()
    change = number
    numberVerify()
def numberVerify():
    if change == 0:
        numberCorrectIsTrue()
    else:
        number = change
def numberCorrectIsTrue():
    count = count + 1
    integer = number
    # checks to see if the input
    # is valid or not.
    if number != integer:
        sp.call('cls', shell=True)
        print("Please enter a valid number!")
        loop()
    else:
        even = number % 2
    if even == 0:
        print("Substituting x in 'x / 2' with {}".format(number))
        answer = number / 2
    else:
        print("Substitiuting x in '(3 * x) + 1' with {}".format(number))
        answer = number * 3
        answer = answerOdd + 1
    print(answer)
    if answer == 1:
        returnStats()
    else:
       numberCorrectIsTrue()
def returnStats():
    print("Your original input of {} returned as 1.".format(change))
    print("A total of {} operations were executed.".format(count))
    change = change + 1
    count = 0
    sp.call('pause', shell=True)
    numberVerify()
def check():
    number = answer
    numberCorrectIsTrue()
numberInput()
 
     
     
     
    