Skip to content

Instantly share code, notes, and snippets.

@blomer
Last active February 8, 2020 01:59
Show Gist options
  • Select an option

  • Save blomer/ea48bb6cb304a9b0b6453369bc9a6f94 to your computer and use it in GitHub Desktop.

Select an option

Save blomer/ea48bb6cb304a9b0b6453369bc9a6f94 to your computer and use it in GitHub Desktop.
A simple calculator for determining Rocket League credit prices.
# github.com/blomer
def calc(c, r):
value = c/100*r
return value
def get():
try:
c = float(input('Amount of credits: '))
r = float(input('Rate (money per 100): '))
v = calc(c, r)
print(f'Amount in $: {v}')
i = input('Another calculation? (press enter for yes, input "n" for no.): ')
if i == 'n':
exit()
else:
get()
except ValueError as e:
print(f'Invalid input: {e}')
get()
v = calc(c, r)
print(f'Amount in $: {v}')
get()
get()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment