无论输入如何,Python变量都返回“0”

时间:2017-09-07 01:27:34

标签: python python-2.7 variables decimal

这是一个折扣权益计算器的摘录,没有限制德州扑克。

无论F的输入如何,FDec变量都返回0值。它应该将F输入的百分比转换为小数。

问题:如何为FDec返回正确的十进制值而不是0?

print "X = 'Breakeven Folding Frequency'"

print "P = 'Current Size of the Pot'"
print "L = 'Maximum Loss'"
print "W = 'Maximum Gain'"
print "V = 'Villain Equity'"
print "H = 'Hero Equity'"
print "B.E. when 0 = XP + (1 - X)(-LV + WH)"

P = int(raw_input("Current pot size:"))
S = int(raw_input("Effective stack size:"))
F = int(raw_input("The percentage (%) chance your opponent folds to the shove:"))
print F

FDec = F / 100
print FDec

W = int(raw_input("The percentage (%) chance you win at showdown if your opponent calls the shove:"))
WR = W / 100

if (FR * P) + (1 - FDec) * ((WR * (P + S)) - ((1 - WR) * S)) > 0:
print "The shove is profitable."

if (FR * P) + (1 - FDec) * ((WR * (P + S)) - ((1 - WR) * S)) == 0:
print "The shove is breakeven."

if (FR * P) + (1 - FDec) * ((WR * (P + S)) - ((1 - WR) * S)) < 0:
print "The shove loses money on average."

1 个答案:

答案 0 :(得分:-2)

在python / symbol中返回整数除数。为了得到小数形式,你需要我们//符号。