Skip to content

Instantly share code, notes, and snippets.

@bearlikelion
Created August 14, 2015 20:23
Show Gist options
  • Save bearlikelion/5e284382aa5a8a64ca03 to your computer and use it in GitHub Desktop.
Save bearlikelion/5e284382aa5a8a64ca03 to your computer and use it in GitHub Desktop.
__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