Hong-Phuc Bui
2025-05-06 63e664b8795f0dc7f64fb9ca4209d27cac1155b8
ub3!
2 files added
52 ■■■■■ changed files
ub-2/aufgabe2-tn-liste.py 15 ●●●●● patch | view | raw | blame | history
ub-3/tik-tak-toe.py 37 ●●●●● patch | view | raw | blame | history
ub-2/aufgabe2-tn-liste.py
New file
@@ -0,0 +1,15 @@
teilnehmer = [
    "Danny", "Roi", "Josephin", "Micha", "Rosa",
    "Adam", "Martha", "Johannes", "Peter", "Susanne",
    "Rachel", "Rebekka","Hanna", "Elias", "Debora",
    "Benjamin","Andreas","Ada", "Guido", "Gottlieb",
    "Friedgott"
]
for idx,name in enumerate(teilnehmer):
    print(f"{idx} -> {name}")
for name in teilnehmer:
    print(name)
ub-3/tik-tak-toe.py
New file
@@ -0,0 +1,37 @@
EMPTY = 0
PL1 = 1
PL2 = 2
tafel = [
   [EMPTY, EMPTY, EMPTY],
   [EMPTY, EMPTY, EMPTY],
   [EMPTY, EMPTY, EMPTY],
]
def print_tafel(tafel):
    symbols = ("*", "X", "O")
    for zeile in tafel:
        for c in zeile:
            print(f"{symbols[c]} ",end="")
        print()
def input_ok(tafel, r, c):
    return True
def user_input(user,tafel):
    print(f"Spieler {user} ist dran")
    print("Geben Sie die Zeile und Spalten ein")
    r = int(input("Zeile:  ")) - 1
    c = int(input("Spalte: ")) - 1
    if input_ok(tafel, r, c):
        tafel[r][c] = user
    else:
        print("Eingabe nicht in Ordnung")
print_tafel(tafel)
user_input(1, tafel)
print_tafel(tafel)
user_input(2, tafel)
print_tafel(tafel)