### # Python version of code in Lecture 3 # # What is this code 'meant' to do? # What does this code 'actually' do? # # # TO RUN: python float2.py # # NOTE: in python floats are actually C doubles ! # print ## # This is the same as the C and Java versions # - but as noted Python uses doubles x = 123456789.0 print x, "+ 1 =", x+1 print ## # ... so we can get the same effect by using more digits # this requires us to format the value so it uses fixed notation # rather than scientific notation x = 1234567890123456789.0 print '{:f}'.format(x), "+ 1 =", '{:f}'.format(x+1) print ## # By the way - I've just calculated that I live distance = 1.2345678901234567 # kilometres from here # # Why might you be tempted to question that? # # (the solution to that question is a totally different topic!) ##