initial commit

This commit is contained in:
2025-10-01 10:46:21 +02:00
commit 50a55e19d6
138 changed files with 2037 additions and 0 deletions

43
schleifen/aufgabe3.py Normal file
View File

@@ -0,0 +1,43 @@
# -*- coding: ansi -*-
import random
credits = 5000
items = {
"sofa": 899,
"sessel": 399,
"couchtisch": 229,
"tv_bank": 349,
"b<EFBFBD>cherregal": 299,
"beistelltisch": 119,
"stehlampe": 189,
"teppich": 249,
"vorh<EFBFBD>nge": 149,
"wandregal": 99,
"dekovase": 59,
"wandbild": 199,
"kissen_set": 79,
"decke": 69,
"pflanzenst<EFBFBD>nder": 89
}
while credits > 0:
name, cost = random.choice(list(items.items()))
choice = input(f"Willst du {name} kaufen um {cost}<EFBFBD>? (Y/N/S/G) ")
match choice.upper():
case "Y":
if credits >= cost:
credits -= cost
print(f"{name} gekauft! Verbleibendes Guthaben: {credits}<EFBFBD>")
else:
print("Nicht genug Guthaben!")
case "N":
pass
case "S":
print("Einkauf beendet.")
break
case "G":
print(f"Du hast: {credits}")
case _:
print("Ung<EFBFBD>ltige Eingabe!")