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