Skip to content

Instantly share code, notes, and snippets.

@M0nica
Created February 10, 2017 12:45
Show Gist options
  • Save M0nica/5c2f0cef7979a2f30ce4ac80ef180a1e to your computer and use it in GitHub Desktop.
Save M0nica/5c2f0cef7979a2f30ce4ac80ef180a1e to your computer and use it in GitHub Desktop.
This code outputs "The percent change between 500 and 575 is 0%" on Heroku but "The percent change between 500 and 575 is 15%" locally
original_number = int(request.form['original'])
new_number = int(request.form['new'])
result = ((new_number - original_number)/int(original_number)) * 100
response = "The percent change between " + str(original_number) + " and " + str(new_number) + " is " + str("%.0f%%" % result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment