- Code: Select all
if score > best:
print str(score) + " > " + str(best)
result
- Code: Select all
43.4925092553 > 43.4925092553
43.4925092553 > 43.4925092553
Do you see the problem?
if score > best:
print str(score) + " > " + str(best)
43.4925092553 > 43.4925092553
43.4925092553 > 43.4925092553
>>> if 1 > 1:
... print('not going to print')
...
>>> if 43.4925092553 > 43.4925092553:
... print('not going to print either')
...
>>>
best = 43.4925092553
score = math.exp(1)*16
if score > best:
print str(score) + " > " + str(best)
metulburr@rch ~ $ python2
Python 2.7.6 (default, Feb 26 2014, 12:07:17)
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> a = math.exp(1)*16
>>> a
43.49250925534472
>>> b = 43.4925092553
>>> a > b
True
>>>
>>> math.e
2.718281828459045
>>> math.e*16
43.49250925534472
>>> (math.e*16)>43.4925092553
True
>>>
>>> tolerance = 1e-9
>>> math.e*16 > 43.4925092553
True
>>> math.e*16-43.4925092553 > tolerance
False
>>> math.e*16-43.492509254 > tolerance
True
>>> print("{:.50}".format(math.e))
2.7182818284590450907955982984276488423347473144531
Users browsing this forum: Bing [Bot] and 5 guests