Skip to content
Snippets Groups Projects
Commit 80d31009 authored by Aleksi Kytöviita's avatar Aleksi Kytöviita
Browse files

Upload New File

parent b37e59fd
Branches
Tags
No related merge requests found
luku = 0
while True:
print(f"Luku on {luku}.")
operaatio = input("Anna operaatio (tyhjä lopettaa) : ")
if operaatio == "":
break
elif operaatio[0] == "+":
luku += float(operaatio[1:])
elif operaatio[0] == "-":
luku -= float(operaatio[1:])
elif operaatio[0] == "*":
luku = luku*float(operaatio[1:])
elif operaatio[0] == "/":
luku = luku/float(operaatio[1:])
else:
print("Tarkista syöte. Kirjoita ensimmäiseksi merkiksi operaattori. Hyväksyttyjä operaatioita ovat *, /, + ja -")
print("Kiitos ja moi!")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment