分类: Python/Ruby
2010-08-23 22:57:28
def test1(a):
n = [25,10,5,1]
b = divmod(a,n[0])
print "%s have %s" % (n[0],b[0])
if ( b[1] != 0 ):
c = divmod(b[1],n[1])
if ( c[0] != 0 ):
print "%s have %s" % (n[1],c[0])
else:
d = divmod(c[1],n[2])
if ( d[0] != 0 ):
print "%s have %s" % (n[2],d[0])
else:
print "%s have %s" % (n[3],d[1])
exit
from __future__ import divisiontry:
Fahrenheit = float(raw_input('please input temperature:'))
except ValueError, e:
print 'Error please input number', e
else:
centigrade = (Fahrenheit-32)*(5/9)
print round(centigrade,2),'C'