source: mainline/uspace/dist/src/python/demo/sintab.py@ 95658c9

ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 95658c9 was 2034f98, checked in by Vojtech Horky <vojtechhorky@…>, 12 years ago

Add few Python demos

  • Property mode set to 100644
File size: 543 bytes
Line 
1#!/usr/bin/python
2
3# Probably not very Pythonic, but it runs well with both Python2 and Python3
4
5import math
6import sys
7
8sys.stdout.write(" ")
9for frac_part in range(0,10):
10 sys.stdout.write(" %5d" % frac_part)
11print("")
12
13for angle_deg in range(0,90):
14 sys.stdout.write("%3d " % angle_deg)
15 for angle_deg_frac in range(0,10):
16 angle = math.radians(angle_deg + angle_deg_frac/10.)
17 value = math.sin(angle) * 10000 + 0.5
18 if value > 10000:
19 sys.stdout.write(" %05d" % (value))
20 else:
21 sys.stdout.write(" %04d" % (value))
22 print("")
23
Note: See TracBrowser for help on using the repository browser.