0

I made a simple root and squared calculator , and If I type anything that is not R or P or r or p it shouldn't let you , but it does. Can someone help me?

The code is below :

while a == 1:
    question = input("R pentru radical , P pentru patrat perfect : ")
    if question in("R", "r"):
        number = int(input("Zi un numar : "))
        sqrt = number ** 0.5
        print("Radical:", sqrt)
    elif question in("p" or "p"):
        patrat = int(input("Zi un numar : "))
        outpatrat = patrat ** 2
        print("Patrat perfect:", outpatrat)
    else :
        print("Cuvant incorect!")

    time.sleep(1)

    answer = input("Apasa Y pentru a folosi din nou programul , N pentru a iesi : ") 
    if answer == "Y" :
        a == 1
    elif answer != "Y" or "N":
        exit()
    elif answer == "N": 
        exit()  ```
zAndrewi
  • 9
  • 1
  • 4

0 Answers0