Skip to content

Instantly share code, notes, and snippets.

@fbentele
Created December 10, 2012 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbentele/4250525 to your computer and use it in GitHub Desktop.
Save fbentele/4250525 to your computer and use it in GitHub Desktop.
Calculating some numbers
#! /usr/bin/env python
# F. Bentele, 10.12.2012
# Calculate some inputs
# declare variables
zahl_gelesen = 1
i = 0
summe = 0
while zahl_gelesen:
temp = raw_input("Geben Sie den " + str(i+1) + ". Preis ein: ")
if temp == "x":
print "Ende"
zahl_gelesen = 0;
elif temp.isdigit():
summe += float(temp)
i += 1
else:
print "Keine Nummer eingegeben"
if summe >= 100 and summe<1000:
print "Der Gesamtpreis ist " + str(summe*0.95) + " CHF nach 5% Rabatt"
elif summe>=1000:
print "Der Gesamtpreis ist " + str(summe*0.9) + " CHF nach 10% Rabatt"
else:
print "Der Gesamtpreis ist " + str(summe) + " CHF nach 0% Rabatt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment