summaryrefslogtreecommitdiffstats
path: root/kasus.py
blob: ba286eb951cfcfc18b7a7dcbea83c9e6dd913a50 (plain)
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
from colorama import Fore, Back, Style

import query
import solver

total = 0
correct = 0

while True:
    case, article, number, adjective, noun = query.get()

    parameters = f"{Fore.MAGENTA}{case}, {Fore.BLUE}{article}, {Fore.YELLOW}{number}{Style.RESET_ALL}"
    queryString = f"{noun}, {adjective}"

    total += 1
    print(f"{Style.BRIGHT}--- Übung {total} ---{Style.NORMAL}")
    print(parameters)
    print(queryString)
    print()

    response = input("> ")

    solution = solver.solve(case, article, number, adjective, noun)
    print(f"{Style.BRIGHT}", end="")

    if response == solution:
        correct += 1
        print(f"{Fore.GREEN}Richtig ({correct}/{total})")
    else:
        print(f"{Fore.RED}Falsch ({correct}/{total}):{Style.RESET_ALL} {solution}")

    print(f"{Style.RESET_ALL}")