diff --git a/Demo_1_teht_1.py b/Demo_1_teht_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c716841340cd6e6cfca24b6dddb62601965576a7 --- /dev/null +++ b/Demo_1_teht_1.py @@ -0,0 +1,19 @@ +luku=0 +print(f"Luku on {luku}.") +while True: + input1=(input("Anna operaatio (tyhjä lopettaa): ")) + if input1=="": + print("Kiitos ja moi!") + break + elif input1.find("-")!=-1: + luku-=int(input1[1:]) + print(f"Luku on {round(luku)}.") + elif input1.find("+")!=-1: + luku+=int(input1[1:]) + print(f"Luku on {round(luku)}.") + elif input1.find("*")!=-1: + luku*=int(input1[1:]) + print(f"Luku on {round(luku)}.") + elif input1.find("/")!=-1: + luku/=int(input1[1:]) + print(f"Luku on {round(luku)}.") \ No newline at end of file