Skip to content

Instantly share code, notes, and snippets.

@dzervas
Created September 3, 2019 11:15
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dzervas/33d3d55754310c168e7fe1d7431619b6 to your computer and use it in GitHub Desktop.
E-Food.gr pinata discount calculator
#!/usr/bin/env python3
import sys
# Usage: python efood_pinata.py 5 5 5 3
items = sys.argv[1:]
total = 0
discountp = 0
for i in items:
total += float(i)
if total >= 30:
discountp = (20/30)
print(f"Hit 30€ pinata: -{discountp * 100:.2f}% ")
elif total >= 20:
discountp = (15/20)
print(f"Hit 20€ pinata: -{discountp * 100:.2f}% ")
elif total >= 15:
discountp = (10/15)
print(f"Hit 15€ pinata: -{discountp * 100:.2f}% ")
print(f"Total: {total:.2f}€ Saved: {total - (discountp * total):.2f}€")
for i in items:
print(f"Item {i}€ -> {float(i) * discountp:.2f}€")
@apostroll
Copy link

που είναι το documentation;

@dzervas
Copy link
Author

dzervas commented Sep 3, 2019

Oh yes, here

@apostroll
Copy link

@dzervas
Copy link
Author

dzervas commented Sep 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment