modified: 2.Erste Programme/4. Fahrkartenautomat Python/main.py
new file: "3. \303\234bungen/10.03.2022/Ausgabewerte.py" new file: "3. \303\234bungen/10.03.2022/Programmfehler.py" new file: "3. \303\234bungen/10.03.2022/Zylinder.py"
This commit is contained in:
parent
ce3895240c
commit
f79c423b8e
@ -1,7 +1,7 @@
|
||||
# Zielorte:
|
||||
print("Willkommen bei der DB. \r\nHier können Sie mit Verspätung immer rechnen. \r\nBitte wählen sie ein Zielort aus.")
|
||||
print("Zielorte:\n")
|
||||
print("1.Erfurt-5,80€ \r\n2.Arnstadt-3,50€ \r\n3.Bahnhof Rennsteig-4,00€ \r\n4.Venedig-380,00€ \r\n5.Singapur-1250,00€ \r\n6.Ilmenau-Pörlitzer-Höhe-3,00€ ")
|
||||
print("1.Erfurt-5,80€ \r\n2.Arnstadt-3,50€ \r\n3.Bahnhof Rennsteig-4,00€ \r\n4.Venedig-380,00€ \r\n5.Singapur-1250,00€ \r\n6.Ilmenau-Pörlitzer-Höhe-3,00€\r\n7.Berlin-300,69€\r\n8. Soeul-2500€")
|
||||
ziel = int(input("Bitte wählen sie ein Zielort aus: \r\n"))
|
||||
if ziel == 1:
|
||||
preis=5.80
|
||||
@ -15,6 +15,10 @@ elif ziel == 5:
|
||||
preis=1250.00
|
||||
elif ziel == 6:
|
||||
preis=3.00
|
||||
elif ziel == 7:
|
||||
preis = 300.69
|
||||
elif ziel == 8:
|
||||
preis = 2500
|
||||
else:
|
||||
print("Bitte geben sie einen gültigen Wert ein.")
|
||||
exit()
|
||||
@ -26,11 +30,11 @@ zu_zahlen = anzahl * preis
|
||||
#Rabattierung:
|
||||
alter=int(input("Bitte geben sie ihr Alter ein: \r\n"))
|
||||
if alter > 65:
|
||||
zu_zahlen_gesamt = round(zu_zahlen * 0.5)
|
||||
zu_zahlen_gesamt = round(zu_zahlen * 0.5, 2)
|
||||
elif alter < 8:
|
||||
zu_zahlen_gesamt = round(zu_zahlen * 0.25)
|
||||
zu_zahlen_gesamt = round(zu_zahlen * 0.25, 2)
|
||||
elif alter > 8 and alter <= 17:
|
||||
zu_zahlen_gesamt = round(zu_zahlen * 0.75)
|
||||
zu_zahlen_gesamt = round(zu_zahlen * 0.75, 2)
|
||||
else:
|
||||
zu_zahlen_gesamt = zu_zahlen
|
||||
|
||||
@ -44,10 +48,8 @@ sie_zahlen=int(input())
|
||||
if sie_zahlen < zu_zahlen_gesamt:
|
||||
print("Sie haben nicht genug Geld.")
|
||||
exit()
|
||||
else:
|
||||
print("Sie haben", sie_zahlen - zu_zahlen_gesamt, "Euro übergeben.")
|
||||
|
||||
rest=sie_zahlen-zu_zahlen_gesamt
|
||||
rest=round(sie_zahlen-zu_zahlen_gesamt, 2)
|
||||
print("Restbetrag:", rest)
|
||||
rest_in_Cent=rest*100
|
||||
print("Restbetrag in Cent:", rest_in_Cent)
|
||||
@ -58,54 +60,38 @@ rest_in_Cent=rest_in_Cent%200
|
||||
if anzahl_2Euro>=1:
|
||||
#print("2€:", anzahl_2Euro)
|
||||
print("Sie bekommen:",anzahl_2Euro, "x 2€ Stücken zurück.")
|
||||
else:
|
||||
pass
|
||||
anzahl_1Euro=rest_in_Cent//100
|
||||
rest_in_Cent=rest_in_Cent%100
|
||||
if anzahl_1Euro>=1:
|
||||
#print("1€:", anzahl_1Euro)
|
||||
print("Sie bekommen:",anzahl_1Euro, "x 1€ Stücken zurück.")
|
||||
else:
|
||||
pass
|
||||
anzahl_50Cent=rest_in_Cent//50
|
||||
rest_in_Cent=rest_in_Cent%50
|
||||
if anzahl_50Cent>=1:
|
||||
#print("50Cent:", anzahl_50Cent)
|
||||
print("Sie bekommen:",anzahl_50Cent, "x 50Cent Stücken zurück.")
|
||||
else:
|
||||
pass
|
||||
anzahl_20Cent=rest_in_Cent//20
|
||||
rest_in_Cent=rest_in_Cent%20
|
||||
if anzahl_20Cent>=1:
|
||||
print("20Cent:", anzahl_20Cent)
|
||||
#print("20Cent:", anzahl_20Cent)
|
||||
print("Sie bekommen:",anzahl_20Cent, "x 20Cent Stücken zurück.")
|
||||
else:
|
||||
pass
|
||||
anzahl_10Cent=rest_in_Cent//10
|
||||
rest_in_Cent=rest_in_Cent%10
|
||||
if anzahl_10Cent>=1:
|
||||
#print("10Cent:", anzahl_10Cent)
|
||||
print("Sie bekommen:",anzahl_10Cent, "x 10Cent Stücken zurück.")
|
||||
else:
|
||||
pass
|
||||
anzahl_5Cent=rest_in_Cent//5
|
||||
rest_in_Cent=rest_in_Cent%5
|
||||
if anzahl_5Cent>=1:
|
||||
#print("5Cent:", anzahl_5Cent)
|
||||
print("Sie bekommen:",anzahl_5Cent, "x 5Cent Stücken zurück.")
|
||||
else:
|
||||
pass
|
||||
anzahl_2Cent=rest_in_Cent//2
|
||||
rest_in_Cent=rest_in_Cent%2
|
||||
if anzahl_2Cent>=1:
|
||||
#print("2Cent:", anzahl_2Cent)
|
||||
print("Sie bekommen:",anzahl_2Cent, "x 2Cent Stücken zurück.")
|
||||
else:
|
||||
pass
|
||||
anzahl_1Cent=rest_in_Cent//1
|
||||
rest_in_Cent=rest_in_Cent%1
|
||||
if anzahl_1Cent>=1:
|
||||
#print("1Cent:", anzahl_1Cent)
|
||||
print("Sie bekommen:",anzahl_1Cent, "x 1Cent Stücken zurück.")
|
||||
else:
|
||||
pass
|
11
3. Übungen/10.03.2022/Ausgabewerte.py
Normal file
11
3. Übungen/10.03.2022/Ausgabewerte.py
Normal file
@ -0,0 +1,11 @@
|
||||
## Übung Wertzuweisung
|
||||
|
||||
x=12
|
||||
y=8
|
||||
|
||||
z=y*x+2 #8*12+2 = 98
|
||||
v=z%x #2
|
||||
w=z//x #8
|
||||
u=v**w #256
|
||||
|
||||
print(z,v,w,u)
|
17
3. Übungen/10.03.2022/Programmfehler.py
Normal file
17
3. Übungen/10.03.2022/Programmfehler.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Programmfehler finden!
|
||||
'''
|
||||
print('Gib Zahl 1 ein")
|
||||
input zahl1
|
||||
input(Gib Zahl 2 ein)
|
||||
|
||||
differenz=zahl1+zahl2
|
||||
print(diffrenz)
|
||||
'''
|
||||
# Lösung
|
||||
# Programm, welches die Differenz zweier Zahlen berechnet (also Subtraktion/Minus)
|
||||
print('Gib Zahl 1 ein')
|
||||
zahl1 = int(input())
|
||||
zahl2 = int(input("Gib Zahl 2 ein"))
|
||||
|
||||
differenz=zahl1-zahl2
|
||||
print(differenz)
|
16
3. Übungen/10.03.2022/Zylinder.py
Normal file
16
3. Übungen/10.03.2022/Zylinder.py
Normal file
@ -0,0 +1,16 @@
|
||||
# Das Programm berechnet den Oberflächinhalt und Volumen eines Zylinders
|
||||
from cmath import pi
|
||||
|
||||
|
||||
durchmesser = int(input('Durchmesser:'))
|
||||
höhe = int(input('Höhe:'))
|
||||
|
||||
# hier felt die Verabreitung
|
||||
radius=durchmesser/2
|
||||
# Oberflächeninhalt
|
||||
oberflächeninhalt=2*pi*radius*(radius+höhe)
|
||||
|
||||
#Volumen
|
||||
volumen=pi*(radius**2)*höhe
|
||||
# Ausgabe
|
||||
print('Oberflächeninhalt',oberflächeninhalt,'\r\n','Volumen:', volumen)
|
Loading…
x
Reference in New Issue
Block a user