0

Hey guys im new in python. I research all of the questions like mine but my english is low, and my python knowledge is low too. So, there is the question. Im making a calculator with python.

giriş = """

(1) topla (2) çıkar (3) çarp (4) böl (5) karesini hesapla (6) kare kök hesapla Çıkmak için "q" basınız. """ print(giriş) anahtar = 1 while True: soru = input("Yapacağınız işlemin numarasını giriniz: ")

if  soru == "q":
    print("Çıkılıyor...")
    break

elif  soru == "1":
    print("Toplama işlemini seçtiniz!")
    top1 = input("Bir sayı giriniz: ")
    top2 = input("diğer sayıyı giriniz: ")
    top1 = int(top1)
    top2 = int(top2)
    print("Sonucunuz:", top1 + top2)

elif soru == "2":
    print("Çıkarma işlemini seçtiniz!") 
    cik1=input("Bir sayı giriniz: ")
    cik2=input("diğer sayıyı giriniz: ")
    cik1 = int(cik1)
    cik2 = int(cik2)
    print("Sonucunuz: ", cik1 - cik2)

elif soru == "3":
    print("Çarpma işlemini seçtiniz!")
    carp1=input("Bir sayı giriniz: ")
    carp2=input("diğer sayıyı giriniz: ")
    carp1=int(carp1)
    carp2=int(carp2)
    print("Sonucunuz: ", carp1 * carp2)

elif soru == "4":
    print("Bölme işlemi seçtiniz!")
    bol1=input("Bir sayı giriniz: ")
    bol2=input("diğer sayıyı giriniz: ")
    bol1=int(bol1)
    bol2=int(bol2)
    print("Sonucunuz: ", bol1 / bol2)

 elif soru == "5": 
    print("Karesini bulmayı seçtiniz!")
    kare1=input("Karesi hesaplanacak sayıyı giriniz: ")
    kare1 = int(kare1)
    print("Sonucunuz: ", pow(kare1,2))

 elif soru == "6":
    print("Karekök bulmayı seçtiniz!" )
    karekok=input("Karekökü bulunacak sayıyı giriniz: ")
    karekok= int(karekok)
    print("Sonucunuz: ", karekok ** 0.5 )

  else:
    print("Yanlış seçim! Lütfen aşağıdakilerden birini seçiniz.", giriş)
    print("-"*30)

The problem is in here:

elif soru == "5": 
    print("Karesini bulmayı seçtiniz!")
    kare1=input("Karesi hesaplanacak sayıyı giriniz: ")
    kare1 = int(kare1)
    print("Sonucunuz: ", pow(kare1,2))

When i run the program, signing this code block and saying: "unindent does not match any outer indentation level"

Thanks in advance

1
  • 1
    Look at the elif soru == "5": line - it's indented by one space (as opposed to the previous elifs which begin at the start of the line). The error message was trying to tell you exactly that. Jan 31, 2016 at 12:37

2 Answers 2

2

You just need to fix your indentation this way:

# ...    

elif soru == "4":
    print("Bölme işlemi seçtiniz!")
    bol1=input("Bir sayı giriniz: ")
    bol2=input("diğer sayıyı giriniz: ")
    bol1=int(bol1)
    bol2=int(bol2)
    print("Sonucunuz: ", bol1 / bol2)

# remove the spaces before 'elif'
elif soru == "5":
    print("Karesini bulmayı seçtiniz!")
    kare1=input("Karesi hesaplanacak sayıyı giriniz: ")
    kare1 = int(kare1)
    print("Sonucunuz: ", pow(kare1,2))

# remove the spaces before 'elif'
elif soru == "6":
    print("Karekök bulmayı seçtiniz!" )
    karekok=input("Karekökü bulunacak sayıyı giriniz: ")
    karekok= int(karekok)
    print("Sonucunuz: ", karekok ** 0.5 )

# remove the spaces before 'else'
else:
    print("Yanlış seçim! Lütfen aşağıdakilerden birini seçiniz.", giriş)
    print("-"*30)
2
  • 1
    Worked! Thanks a lot :)
    – teoman
    Jan 31, 2016 at 12:36
  • @TeomanYüksel you're welcome Jan 31, 2016 at 12:40
2

you have a space or two before that clause:

 elif soru == "5": 
     print("Karesini bulmayı seçtiniz!")
     kare1=input("Karesi hesaplanacak sayıyı giriniz: ")
     kare1 = int(kare1)
     print("Sonucunuz: ", pow(kare1,2))

when in reality it should be:

elif soru == "5": 
    print("Karesini bulmayı seçtiniz!")
    kare1=input("Karesi hesaplanacak sayıyı giriniz: ")
    kare1 = int(kare1)
    print("Sonucunuz: ", pow(kare1,2))

That should fix your problem, keep up the good work!

3
  • This is actually wrong. You need to indent the statements that follow the elif. Jan 31, 2016 at 12:41
  • Sorry i wrote this on a tablet and the formatting was rather tricky, its been amended now. Jan 31, 2016 at 13:30
  • Happens to the best, +1 Jan 31, 2016 at 13:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.