Python'da koddaki hatayı bulamıyorum

import time
import os



def soru1():
    durum1 = None
    while True:
        try:
            soru1 = int(input("İlk olarak Günde Ortalama Kaç Saat oyun oynadığınızı öğreneceğiz: "))
            durum1 = True
        except ValueError:
            print("Lütfen Tam Sayı Şeklinde Ortalama Günde Kaç Saat Oyun Oynadığınızı Yazın")
            time.sleep(5)
        if soru1 >= 16:
            print("Bu kadar fazla oyun oynaman muhtemel değil!")
            continue
        elif durum1 == True:
            with open("sorucevap.txt", "a", encoding="utf-8") as file:
                file.writelines(f"Soru1:{str(soru1)}\n")
                time.sleep(1)
                print("Güzel İlerliyoruz 2. Soruya Geçelim!")
                time.sleep(1.5)
                break
def soru2():
    durum2 = None
    while True:
        try:
            soru2 = int(input("Günde Ortalama Kaç Saat Kitap okursunuz?: "))
            durum2 = True

        except ValueError:
            print("Lütfen Tam Sayı Şeklinde Günde Ortalama Kaç saat kitap okuduğunuzu Tam sayı cinsinden yazın yazın")
            time.sleep(2)
        if soru2 >= 16:
            print("Bu Kadar Kitap Okumanız Muhtamel Değil!")
            continue
        elif durum2 == True:
            with open("sorucevap.txt","a",encoding="utf-8") as file:
                file.writelines(f"Soru2:{str(soru2)}\n")
                time.sleep(1)
                print("Güzel!,Şimdi 3. Soru")
                time.sleep(1.5)
                break
def soru3():
    durum3 = None
    while True:
        try:
            soru3 = int(input("Günde Kaç Saat Bireysel Çalışma Yapıyorsunuz?: "))
            durum3 = True

        except ValueError:
            print("Lütfen Günde Ortalama Kaç Saat Bireysel Çalışma Yaptığınızı Tam Sayı Cinsinden Yazın")
            time.sleep(2)

        if soru3 >= 16:
            print("Bu Kadar Bireysel Çalışma Yapmanız Muhtamel Değil!")
            continue
        elif durum3 == True:
            with open("sorucevap.txt", "a", encoding="utf-8") as file:
                file.writelines(f"Soru3:{str(soru3)}")
                break
def seviyeb():
    etki_tablosu = {
        "Soru1": {0: 0, 1: 0, 2: -0.3, 3: -0.5, 4: -0.7, 5: -0.9, 6: -1, 7: -1.1, 8: -1.2, 9: -1.3, 10: -1.4, 11: -1.5,12: -1.6, 13: -1.7, 14: -1.8, 15: -1.9},
        "Soru2": {0: -1.5, 1: 0.8, 2: 1, 3: 1.1, 4: 1.2, 5: 1.3, 6: 1.4, 7: 1.5, 8: 1.6, 9: 1.7, 10: 1.8, 11: 1.9,12: 2, 13: 2, 14: 2, 15: 2},
        "Soru3": {0: -0.8, 1: -0.4, 2: 0, 3: 0.5, 4: 0.8, 5: 1, 6: 1.5, 7: 1.8, 8: 2, 9: 2.2, 10: 2.4, 11: 2.6, 12: 2.8,13: 3, 14: 3, 15: 3.2}
    }

    seviye = 0
    with open("sorucevap.txt", "r", encoding="utf-8") as file:
        top = 0
        for line in file:
            soru, cevap = line.strip().split(":")
            cevapp = int(cevap)

            top += cevapp
            if soru in etki_tablosu:
                seviye += etki_tablosu[soru].get(int(cevap), 0)

            if top > 24:
                print("Çalışma Saatleriniz 24 saat'i yani bir günü aşıyor.Bir günde bir günden fazla nasıl çalışma yapabiliyorsun? ")
                break
        seviye2 = (seviye,1)
        print("Seviyeniz:", seviye2)
        with open("seviye.txt","w",encoding="utf-8") as file2:
            file2.writelines(str(seviye2))

def baslangic():
    print("""Kullanıcı Tanımlama

Programa Başlamadan önce şu anki seviyenizi belirlemek için

size birkaç soru soracağız ve bu sorulardan yola çıkarak seviyenizi belirleyeceğiz

Hazırsanız Soruları Yöneltmeye 10 saniye içinde Başlıyoruz 

Smark O.Y.
""")
    #KENDİME NOT:zaman işleri şu an yazım ve test sürecinde olduğu için düşük sonra düzenlemeyi unutma!
    time.sleep(1)
    
def basla():
    baslangic()
    soru1()
    soru2()
    soru3()
    seviyeb()
    with open("mesaj.txt","w",encoding="utf-8") as file2:
        pass
class Anaprogram ():
    def __init__(self,seviye):
        with open("seviye.txt","r",encoding="utf-8") as file:
            self.seviye = file.read()
    def __str__(self):
        with open("seviye.txt","r",encoding="utf-8") as file:
            self.seviye = file.read()
        try:
            self.seviye = int(self.seviye)
        except ValueError:
            self.seviye = float(self.seviye)
        return (f"""Senin İstatistiklerin
        
Seviye : {round(self.seviye,1)}
        """)
    def seviye_yükseltme(self,yapilan_iş_numarasi,saat):
        etki_tablosu1 = {
            1: {0: 0, 1: 0.2, 2: 0.4, 3: 0.6, 4: 0.8, 5: 1, 6: 0.9, 7: 0.7, 8: 0.5, 9: 0.4, 10: 0.3,11: 0.2,12: 0.1, 13: 0.1, 14: 0.1, 15: 0.1},
            2: {0: 0, 1: 0.4, 2: 8, 3: 1, 4: 1.2, 5: 1.4, 6: 1.6, 7: 1.8, 8: 2, 9: 2.1, 10: 2.2, 11: 2.3,12: 2.4, 13: 2.5, 14: 2.6, 15: 2.7},
            3: {0: 0, 1: 0.1, 2: 0, 3: 0, 4: -0.1, 5: -0.1, 6: -0.2, 7: -0.7, 8: -0.8, 9: -0.9, 10: -0.9, 11: -0.9,12: -1,13: -1.2, 14: -1.4, 15: -1.6}
        }
        try:
            self.seviye = round(int(self.seviye),1)
            print("seviye: ",self.seviye)
        except ValueError:
            self.seviye = round(float(self.seviye),1)
            print("Seviye float:",self.seviye)
        if yapilan_iş_numarasi == 1:
            eklenecek_puan = etki_tablosu1[1].get(int(saat),0)
            self.seviye += eklenecek_puan
            self.seviye = round(self.seviye,1)

            with open("seviye.txt","w",encoding="utf-8") as file:
                file.write(str(self.seviye))
                print("Mükemmel! Seviye Puanınız Hesabınıza Aktarıldı.")
        elif yapilan_iş_numarasi == 2:
            eklenecek_puan1 = etki_tablosu1[2].get(int(saat),0)
            self.seviye += eklenecek_puan1
            self.seviye = round(self.seviye,1)

            with open("seviye.txt","w",encoding="utf-8") as file:
                file.write(str(self.seviye))
                print("Mükemmel! Seviye Puanınız Hesabınıza Aktarıldı.")
        elif yapilan_iş_numarasi == 3:
            eklenecek_puan1 = etki_tablosu1[3].get(int(saat),0)
            self.seviye += eklenecek_puan1
            self.seviye = round(self.seviye,1)

            with open("seviye.txt","w",encoding="utf-8") as file:
                file.write(str(self.seviye))
                print("Mükemmel! Seviye Puanınız Hesabınıza Aktarıldı.")






if os.path.exists("mesaj.txt"):
    with open("seviye.txt","r",encoding="utf-8") as file2:
        seviye = file2.read()
        anaprogram = Anaprogram(seviye)
    while True:
        işlem = input("İşlem Seçin 1/2 :")

        if işlem == "1":
            print(anaprogram)
        elif işlem == "2":
            while True:
                print("""
        NO 1:Kitap okumak

        NO 2:Bireysel Çalışma Yapmak

        NO 3:Ders Çalışmak

        NOT : DEVAMI EKLENECEK

                            """)
                string = "Peki Bu Aktiviteyi Günde Kaç Saat Yaptın?: "

                input1 = input("Hangi İşi Yaptınız (İŞ NO'SUNU GİRİN ÖR:2): ")

                if input1 == "q":
                    break
                else:
                    input1 = int(input1)

                    if input1 == 0:
                        print("??")
                        continue
                    if input1 == 1:
                        print("Kitap Okumak,mükemmel!")
                        input2 = int(input(string))
                        if input2 == 0:
                            print("??")
                        if input2 >= 15:
                            print("Bu Kadar Kitap Okuman Muhtemel Değil!")
                            continue
                        else:
                            anaprogram.seviye_yükseltme(input1, input2)
                            time.sleep(1)
                    elif input1 == 2:
                        print("Bireysel Çalışma İşte Bu Mükemmel!")
                        input2 = int(input(string))
                        if input2 == 0:
                            print("??")
                            continue
                        if input2 >= 15:
                            print("YUH!")
                            continue
                        else:
                            anaprogram.seviye_yükseltme(input1,input2)
                            time.sleep(1)
                    elif input1 == 3:
                        print("Ders Çalışmak,boş durmaktan iyidir")
                        input2 = int(input(string))
                        if input2 == 0:
                            print("??")
                            continue
                        if input2 >= 15:
                            print("YUH!")
                            continue
                        else:
                            anaprogram.seviye_yükseltme(input1,input2)
                            time.sleep(1)


else:
    basla()

Kodumun seviye_yükseltme fonksiyonundaki seviye ile eklenecek puanı toplama işlemi çalışmıyor 1. denemede seviye puanını ekliyor 2. denemede ya ekliyor ya eklemiyor yada neden olduğunu anlamadım 0.2 puan ekliyor.Yardımlarınız için teşekkürler

bkz: Soru Sorarken Sıkça Düşülen Hatalar #7

Bende hata vermeden calisti.

Genel olarak self.seviye’nin kullaniminda hata var gibi duruyor. Surekli round ediliyor, zaman zaman int’e veya float’a cevriliyor, dosyaya tuple olarak yaziliyor. Turunu ve olasi degerlerini bir kere belirleyip onun icinde kalmak lazim; her gerektigi zaman degistirilmesi surdurulebilecek bir sey degil. Eger tek ondaliga ihtiyaci varsa 10 kati degerinde bir integer olarak tutulabilir mesela. Okunma icin bir, yazilma icin bir yardimci fonksiyon kullanilabilir. En olmadi kendi class’i haline getirilir, testleri ile.

Dediklerinizi uygulamaya çalışacağım sağolun hocam