Baseball

Run Settings
LanguagePython
Language Version
Run Command
from decimal import Decimal, ROUND_HALF_UP def whip(a, b, c): return Decimal((a+b)/c).quantize(Decimal('.00'), ROUND_HALF_UP) def ops(H, BB, HBP, AB, SF, TB): #obp = Decimal((H+BB+HBP)/(AB+BB+SF+HBP)).quantize(Decimal('.000'), ROUND_HALF_UP) #slg = Decimal(TB/AB).quantize(Decimal('.000'), ROUND_HALF_UP) return Decimal(((H+BB+HBP)/(AB+BB+SF+HBP))+(TB/AB)).quantize(Decimal('.000'), ROUND_HALF_UP) for x in range(10): if x == 0: a, b, c = input().split(' ') a, b, c = int(a), int(b), int(c) print(whip(a, b, c)) else: H, BB, HBP, AB, SF, TB = input().split(' ') H, BB, HBP, AB, SF, TB = int(H), int(BB), int(HBP), int(AB), int(SF), int(TB) print(ops(H, BB, HBP, AB, SF, TB))
Editor Settings
Theme
Key bindings
Full width
Lines