Add LF5 Aufgaben

This commit is contained in:
2022-02-13 18:09:17 +01:00
parent ba8b79dd36
commit 6685e379a0
8 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env python3
l = []
while True:
try:
i = int(input("Eine Zahl: "))
except:
break
l.append(i)
s = sorted(l)
print(s)

View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python3
hs = {}
print("Bitte Länder eingeben:")
while True:
land = input("Land: ")
if land == "":
break
stadt = input("Hauptstadt: ")
if stadt == "":
break
hs[land] = stadt
print("Nun Länder abfragen:")
while True:
land = input("Land: ")
if land == "":
break
print(hs[land])

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env python3
schulden = int(input("Schulden (€): "))
zinsen = int(input("Zinsen (%): "))
rate = int(input("Monatliche Rate (€): "))
print("Du bist nach {} Monaten schuldenfrei".format((schulden*((zinsen/100)+1))/rate))

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env python3
def generatePasswort(name):
vokale = "aeiouäöüAEIOUÄÖÜ "
pw = ""
for n in name:
if n not in vokale:
pw += n
return pw
tests = [
"Isabell Bauer",
"Markus Müller",
"Annie Claasen",
]
for t in tests:
print(t, ":", generatePasswort(t))
print(generatePasswort(input("Name: ")))