# -*- coding: utf_8 -*- """This program calculates how much money you have to pay for gasoline, and calculates VAT (20% ("PDV" in Ukraine)). You have to enter how many liters you filled and how much 1 liter costs. This program was written for specific bookkeeper needs. Formula: Sum = 1 litter cost * quantity + 20% * (1 litter cost * quantity)""" def PodborCheck(litters, price): full_sum = litters * price sum_wo_vat = 0 vat = 0 x = 0 while x < full_sum: sum_wo_vat += 0.01 vat = sum_wo_vat * 0.2 x = sum_wo_vat + vat print(' ') print('Sum', round(full_sum, 2)) print('VAT', round(vat, 2)) print(' ') def calc(): z = 0 lt = float(input("How many litters? ")) pr = float(input("Cost by one? ")) PodborCheck(lt, pr) try: z = int(input("Press ENTER for exit. Press 1 and ENTER to continue. ")) print(" ") except ValueError: return 0 if z != 1: return 0 else: calc() calc()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question