【发布时间】:2012-01-27 20:28:20
【问题描述】:
嗯,我在打印带小数点的数字时遇到了麻烦。 当我运行 python 并要求它进行除法时,结果必须是带小数点的数字,它不会打印小数点。 比如我刚刚做了这个算法:
print 'Report card calculation'
grade1 = input ('Insert the first grade: ')
grade2 = input ('Insert the second grade: ')
grade3 = input ('Insrt the third grade: ')
media = (grade1 + grade2 + grade3) / 3
print 'Your final result is', media
但是当它打印“媒体”时,应该有小数点的数字没有小数点。我该如何解决?
【问题讨论】:
-
您的意见是什么?它们是整数吗?
标签: python floating-point type-conversion