-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
82 lines (72 loc) · 2.5 KB
/
Copy pathmain.py
File metadata and controls
82 lines (72 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Stadt Land Fluss
# für lokale Spieler
import random
import string
import wikidata
while True:
try:
spieler_anzahl = int(input("Wie viele wollen spielen? "))
except ValueError:
print("Du musst eine Zahl eingeben!")
continue
if spieler_anzahl > 10:
print("Es können maximal 10 Spieler*innen teilnehmen!")
continue
if spieler_anzahl <= 0:
print("Gib bitte eine positive Zahl ein!")
continue
break
print("Lade Daten...")
städte = [
s.casefold()
for s in wikidata.get_item_names_for_category("Q1549591") # Großstadt
]
print(len(städte), "Städte.")
länder = [
l.casefold()
for l in wikidata.get_item_names_for_category("Q6256")
]
print(len(länder), "Länder.")
flüsse = [
f.casefold()
for f in wikidata.get_item_names_for_category("Q1267889") # Waterway
]
print(len(flüsse), "Flüsse.")
while True:
buchstabe = random.choice(string.ascii_lowercase)
städte_mit_buchstabe = [s for s in städte if s.startswith(buchstabe)]
while True:
if not städte_mit_buchstabe:
print("Es gibt keine Stadt mit diesem Buchstaben, deshalb kriegtst du hier nen kostenlosen Punkt ;)")
break
stadt = input(f"Stadt mit {buchstabe.upper()} ('-' zum Aufgeben): ").casefold()
if stadt == "-":
break
if stadt in städte_mit_buchstabe:
print("Richtig!")
break
print("Falsch! Probier's nochmal!")
länder_mit_buchstabe = [l for l in länder if l.startswith(buchstabe)]
while True:
if not länder_mit_buchstabe:
print("Es gibt keine Länder mit diesem Buchstaben, deshalb kriegtst du hier nen kostenlosen Punkt ;)")
break
land = input(f"Land mit {buchstabe.upper()} ('-' zum Aufgeben): ").casefold()
if land == "-":
break
if land in länder_mit_buchstabe:
print("Richtig!")
break
print("Falsch! Probier's nochmal!")
flüsse_mit_buchstabe = [f for f in flüsse if f.startswith(buchstabe)]
while True:
if not flüsse_mit_buchstabe:
print("Es gibt keine Flüsse mit diesem Buchstaben, deshalb kriegtst du hier nen kostenlosen Punkt ;)")
break
fluss = input(f"Fluss mit {buchstabe.upper()} ('-' zum Aufgeben): ").casefold()
if fluss == "-":
break
if fluss in flüsse_mit_buchstabe:
print("Richtig!")
break
print("Falsch! Probier's nochmal!")