I am making a python code to check if chaddar equal 1 and 'yes' in horn. However I cannot get the chaddar number from def sth(chaddar) and my code always print error. I cannot use golbal variable I can only use local variable.So I really need some help. Thanks
Here is my code:
def sth(chaddar):
chaddar = 1
def basic(chaddar):
horn = input("answer: ")
if chaddar ==1 and "yes" in horn:
print("ok")
else:
print("error")
sth('chaddar')
basic('chaddar')
My Terminal:
answer: yes
error