UnboundLocalError when I assigned the variable before reference

Yes, this is a Python code
I made a code where user can input some words and the program will respond to it
The code with error for some reason
This is a part of code in the project where the entire problem happens in here
It shows this


I assigned local variable ‘chek’ in line 19 and it says it is referenced (Line20) before assignment( (Line19)
Does it run line 20 before 19 or what

1 Like

Fixed, it seems that the problem is from deleting variables at last and for some reason it jump back to the front skipping come codes
Also fixed some potential bugs

1 Like