"count + = 1"でエラーが発生しました。私はそれを世界的にしようとしましたが、それでも問題はありました。それは何よりも冗談ですが、なぜそれが機能していないのか知りたいのですが。UnboundLocalError:割り当て前にローカル変数 'count'が参照されています。
import math
def delT():
#inputs
#float inputs
#do math
#print results
global count
count=0
def getAndValidateNext():
#print menu
getNext=input("select something")
acceptNext=["things","that","work"]
while getNext not in acceptNext:
count+=1
print("Not a listed option.")
if count==5:
print("get good.")
return
return(getAndVadlidateNext())
if getNext in nextRestart:
print()
return(delT())
if getNext in nextExit:
return
getAndVadlidateNext()
delT()
フルトレースバックしてください。私の目が正しく見えても関数は呼び出されません。 –
'getAndVadlidateNext'とは何ですか? – user2357112
[Pythonのネストされた関数の変数スコープの可能な複製](https://stackoverflow.com/questions/5218895/python-nested-functions-variable-scoping) – janos