Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # повтаряме: въвеждаме текст
- # спираме: текст == "NoMoreMoney"
- # продължаваме: текст != "NoMoreMoney"
- text = input() #"NoMoreMoney" или "54.65" -> задаване на начална стойност
- total_sum = 0 # колко ми е наличността в сметката
- while text != "NoMoreMoney":
- # сума под формата на текст (text = "45.6") -> дес. число
- sum = float(text)
- # проверка дали е < 0
- if sum < 0:
- print("Invalid operation!")
- break
- else:
- print(f"Increase: {sum:.2f}")
- total_sum += sum
- text = input()
- print(f"Total: {total_sum:.2f}")
Advertisement
Add Comment
Please, Sign In to add comment