Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2010 Doug Hellmann. All rights reserved.
  5. #
  6. """Basic trigonometric functions
  7. """
  8. #end_pymotw_header
  9.  
  10. import math
  11.  
  12. print 'Degrees Radians Sine Cosine Tangent'
  13. print '------- ------- ------- -------- -------'
  14.  
  15. fmt = ' '.join(['%7.2f'] * 5)
  16.  
  17. for deg in range(0, 361, 30):
  18. rad = math.radians(deg)
  19. if deg in (90, 270):
  20. t = float('inf')
  21. else:
  22. t = math.tan(rad)
  23. print fmt % (deg, rad, math.sin(rad), math.cos(rad), t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement