fork download
  1. from math import *
  2. from random import randrange as r
  3.  
  4. k = pi / 180
  5. h = x = y = 0
  6. d = []
  7. for i in range(5):
  8. a = r(-179,181)
  9. l = r(501)
  10. d += ['%d:%d' % (a, l)]
  11. h += a
  12. x += l * cos(k * a)
  13. y += l * sin(k * a)
  14.  
  15. print('Data: %s\nHeading: %d\nDistance: %f\nOrientation: %f' % (','.join(d), h, sqrt(x*x+y*y), atan2(y,x)/k))
Success #stdin #stdout 0.06s 11856KB
stdin
Standard input is empty
stdout
Data: -11:150,102:17,3:175,9:240,-166:130
Heading: -63
Distance: 429.388883
Orientation: 0.435055