toplama = 1
def yazdir():
if toplama == 1:
toplama += 1
print(toplama)


while True:
user_select = input("Seçiminiz: ")
if user_select == "1":
yazdir()
continue
elif user_select == "2":
format()
continue
else:

continue

while ile gelen sorguya 1 yazarsam yazdir functionu tetiklemesini toplama değerinin 1 eşitse onu 1 sayı daha eklemesini isityorum fakat 1 basınca bu hatayı alıyorum.

UnboundLocalError Traceback (most recent call last)
<ipython-input-2-bb317f8a150d> in <module>
11 user_select = input("Seçiminiz: ")
12 if user_select == "1":
---> 13yazdir()
14 continue
15 elif user_select == "2":

<ipython-input-2-bb317f8a150d> in yazdir()
3 4 ----> 5if toplama == 1:
6 toplama += 1
7 print(toplama)

UnboundLocalError: local variable 'toplama' referenced before assignment

arkadaşlar bana mantığını öğretin hazır kod yazmayın düz mantıkla bunun çalışması gerekiyor çalışmıyor. Yeni başladım