Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. # -*- coding: cp1250 -*-
  2. # http://pastebin.com/k3JYgMgq
  3. from turtle import *
  4. n = 50
  5. def prikazi (t) :
  6. x, y = T[t]
  7. up(); goto (x*n, y*n); pd(); dot(); up()
  8. tx = t +'(' +str(x) +', ' +str(y) +')'
  9. write(' '+tx, True, "left", ("Consolas", 10, "normal"))
  10.  
  11. def spoji (X, Y) :
  12. x, y = T[X]; up(); goto (x*n, y*n)
  13. x, y = T[Y]; pd(); goto (x*n, y*n)
  14. X = T[X]; Y = T[Y]
  15. X = complex (X[0], X[1]); Y = complex (Y[0], Y[1])
  16. return round (abs(X-Y), 2)
  17.  
  18. ht()
  19. up(); goto(-5*n, 0); pd(); goto(5*n, 0)
  20. up(); goto(0, -5*n); pd(); goto(0, 5*n)
  21.  
  22. T = {}
  23. T['A'] = input ('Koordinate točke A ')
  24. T['B'] = input ('Koordinate točke B ')
  25. T['C'] = input ('Koordinate točke C ')
  26.  
  27. prikazi ('A'); prikazi('B'); prikazi ('C')
  28. c = spoji ('A', 'B'); a = spoji ('B', 'C'); b = spoji ('C', 'A')
  29. O = a +b +c; s = O/2; P = (s*(s-a)*(s-b)*(s-c))**0.5
  30. print 'O =', O, 'P =', P
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement