Created
December 10, 2012 13:22
-
-
Save fbentele/4250525 to your computer and use it in GitHub Desktop.
Calculating some numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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