From f4c32022732ae7f20d3092d2c1d9fac70f08bcbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viivi=20R=C3=B6ntynen?= <viivi.t.rontynen@utu.fi> Date: Tue, 29 Aug 2023 19:30:33 +0000 Subject: [PATCH] Upload New File --- Demo_1_teht_1.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Demo_1_teht_1.py diff --git a/Demo_1_teht_1.py b/Demo_1_teht_1.py new file mode 100644 index 0000000..c716841 --- /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 -- GitLab