#Stephen Bowen 2020

#Input function
def InputVariable(variable, NegativeAllowed):
    while True:
        try:
            value = float(input(variable))
        except ValueError:
            print("Please only enter a number.")
        else:
            if NegativeAllowed == True:
                return value
            else:
                if value < 0:
                    print("Please only enter a number >= 0.")
                elif value >= 0:
                    return value

#Calculate final position
def ObjectPosition():
    #Check and assign variables to input
    x_0 = InputVariable("Initial Position: ", True)
    v_0 = InputVariable("Initial Velocity: ", True)
    a = InputVariable("Acceleration: ", True)
    t = InputVariable("Time: ", False)

    #Calculate final position
    x_f = x_0 + (v_0 * t) + (.5 * a * (t ** 2))

    #Print final position
    print("The final position is {} units".format(x_f))

    #Go Again
    GoAgain = str(input("Calculate another object's position? (Y/N): "))
    if GoAgain.lower() == "y":
        ObjectPosition()
    else:
        print("Have a nice day!")
        
#Main
if __name__ == "__main__":
    ObjectPosition()


fce26d40366e2d515846d2a110de03f06c28243a
<mask token>

<mask token>


def ObjectPosition():
    x_0 = InputVariable('Initial Position: ', True)
    v_0 = InputVariable('Initial Velocity: ', True)
    a = InputVariable('Acceleration: ', True)
    t = InputVariable('Time: ', False)
    x_f = x_0 + v_0 * t + 0.5 * a * t ** 2
    print('The final position is {} units'.format(x_f))
    GoAgain = str(input("Calculate another object's position? (Y/N): "))
    if GoAgain.lower() == 'y':
        ObjectPosition()
    else:
        print('Have a nice day!')


<mask token>

def InputVariable(variable, NegativeAllowed):
    while True:
        try:
            value = float(input(variable))
        except ValueError:
            print('Please only enter a number.')
        else:
            if NegativeAllowed == True:
                return value
            elif value < 0:
                print('Please only enter a number >= 0.')
            elif value >= 0:
                return value


def ObjectPosition():
    x_0 = InputVariable('Initial Position: ', True)
    v_0 = InputVariable('Initial Velocity: ', True)
    a = InputVariable('Acceleration: ', True)
    t = InputVariable('Time: ', False)
    x_f = x_0 + v_0 * t + 0.5 * a * t ** 2
    print('The final position is {} units'.format(x_f))
    GoAgain = str(input("Calculate another object's position? (Y/N): "))
    if GoAgain.lower() == 'y':
        ObjectPosition()
    else:
        print('Have a nice day!')


<mask token>

def InputVariable(variable, NegativeAllowed):
    while True:
        try:
            value = float(input(variable))
        except ValueError:
            print('Please only enter a number.')
        else:
            if NegativeAllowed == True:
                return value
            elif value < 0:
                print('Please only enter a number >= 0.')
            elif value >= 0:
                return value


def ObjectPosition():
    x_0 = InputVariable('Initial Position: ', True)
    v_0 = InputVariable('Initial Velocity: ', True)
    a = InputVariable('Acceleration: ', True)
    t = InputVariable('Time: ', False)
    x_f = x_0 + v_0 * t + 0.5 * a * t ** 2
    print('The final position is {} units'.format(x_f))
    GoAgain = str(input("Calculate another object's position? (Y/N): "))
    if GoAgain.lower() == 'y':
        ObjectPosition()
    else:
        print('Have a nice day!')


if __name__ == '__main__':
    ObjectPosition()

#Stephen Bowen 2020

#Input function
def InputVariable(variable, NegativeAllowed):
    while True:
        try:
            value = float(input(variable))
        except ValueError:
            print("Please only enter a number.")
        else:
            if NegativeAllowed == True:
                return value
            else:
                if value < 0:
                    print("Please only enter a number >= 0.")
                elif value >= 0:
                    return value

#Calculate final position
def ObjectPosition():
    #Check and assign variables to input
    x_0 = InputVariable("Initial Position: ", True)
    v_0 = InputVariable("Initial Velocity: ", True)
    a = InputVariable("Acceleration: ", True)
    t = InputVariable("Time: ", False)

    #Calculate final position
    x_f = x_0 + (v_0 * t) + (.5 * a * (t ** 2))

    #Print final position
    print("The final position is {} units".format(x_f))

    #Go Again
    GoAgain = str(input("Calculate another object's position? (Y/N): "))
    if GoAgain.lower() == "y":
        ObjectPosition()
    else:
        print("Have a nice day!")
        
#Main
if __name__ == "__main__":
    ObjectPosition()

