0
Ich bin neu in Python und ich bin irgendwie fest. Wenn ich mein Programm laufen lasse, erhalte ich dieseTypeError: YN_prompt() fehlt 1 benötigt positional Argument: 'self'
"Traceback (most recent call last):
File "C:/Users/Dell/Documents/Code/junk.py", line 1, in <module>
class E:
File "C:/Users/Dell/Documents/Code/junk.py", line 27, in E
YN_prompt()
TypeError: YN_prompt() missing 1 required positional argument: 'self'
Ich verstehe nicht, was ich falsch mache, kann mir bitte jemand erklären, was die Fehlermeldung bedeutet? Vielen Dank.
class E:
import random
import time
thing = 1
cookie = random.randrange(4)
def YN_prompt(self):
ugly = 1
while ugly == 1:
yn = input("\n Go again? y/n \n")
if yn == ("y"):
continue
elif yn == ("n"):
quit()
else:
print("ILLEGAL VALUE, CHOOSING ANOTER")
time.sleep(0.2)
continue
while thing == 1:
if cookie == 0:
print("hi")
YN_prompt()
elif cookie == 1:
print("no")
YN_prompt()
elif cookie == 2:
print("why")
YN_prompt()
elif cookie == 3:
print("when")
YN_prompt()
elif cookie == 4:
print("who")
YN_prompt()