Traceback (most recent call last):
File "C:\Users\User\Desktop\Python\Englisch.py", line 7, in <module>
Abfrage()
File "C:\Users\User\Desktop\Python\Unit1.py", line 289, in Abfrage
return e, d
UnboundLocalError: local variable 'e' referenced before assignment
Und das Hauptprogramm:
Code: Alles auswählen
import random
from Unit1 import *
while True:
    Abfrage()
    question_and_answers = [(e, d)]
    question, answer = random.choice(question_and_answers)
    b = random.randint(1,2)
    
    if b == 1:
          print("")
          print(question)
          c = input("")            
          if c == answer:
              print("richtig")
          else:
             print("falsch, richtig wäre:")
             print(answer)
    if b == 2:
        print("")
        print(answer)
        c = input("")            
        if c == question:
            print("richtig")
        else:
            print("falsch, richtig wäre:")
            print(question)
