sorting and PLF example 2 with modern form.
a lot of C# to be real!
This commit is contained in:
33
PLF/plf/bsp2.py
Normal file
33
PLF/plf/bsp2.py
Normal file
@@ -0,0 +1,33 @@
|
||||
print("Berge Österreich")
|
||||
b = ["Großglockner","Wildspitze","Weißkugel","Großvenediger"]
|
||||
h = [3798,3768,3738,3657]
|
||||
|
||||
while True:
|
||||
ein=str(input("Neue Eingabe (j/n)? "))
|
||||
if ein == "j":
|
||||
nb = str(input("Name des Berges: "))
|
||||
nh = int(input("Höhe: "))
|
||||
|
||||
if nb in b:
|
||||
print("Schon vorhanden")
|
||||
else:
|
||||
b.append(nb)
|
||||
h.append(nh)
|
||||
else:
|
||||
break
|
||||
|
||||
for x,y in zip(b,h):
|
||||
print(x,":",y)
|
||||
|
||||
ma = max(h)
|
||||
i = h.index(ma)
|
||||
print("Der höchste Berg der Liste ist der",b[i],"mit einer Höhe von",ma,"m")
|
||||
|
||||
d = sum(h)/len(h)
|
||||
print("Die durchschnittliche Höhe aller Berge beträgt",d,"m.")
|
||||
|
||||
z = 0
|
||||
for x in h:
|
||||
if x >= 3000:
|
||||
z+=1
|
||||
print("In der Liste sind",z,"3000er gespeichert.")
|
||||
Reference in New Issue
Block a user