Created
August 14, 2015 20:23
-
-
Save bearlikelion/5e284382aa5a8a64ca03 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Mark Arneman' | |
def promptInput(): | |
# Add Instructions | |
equation = input('Enter your equation: ') | |
return solveEquation(equation) | |
def validateInput(input): | |
if input.find('x') == -1 or input.find('=') == -1: | |
print('Invalid Equation \n') | |
return promptInput() | |
else: | |
print('Valid Equation! \n') | |
return True | |
def solveEquation(input): | |
validateInput(input) | |
# Solving equation logic here | |
promptQuit() | |
def promptQuit(): | |
prompt = input('Solve another equation [Y/N]: ') | |
if prompt.upper() == "Y": | |
promptInput() | |
elif prompt.upper() == 'N': | |
exit() | |
else: | |
print('Invalid Input') | |
promptQuit() | |
promptInput() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment