Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: cp1250 -*-
- # http://pastebin.com/k3JYgMgq
- from turtle import *
- n = 50
- def prikazi (t) :
- x, y = T[t]
- up(); goto (x*n, y*n); pd(); dot(); up()
- tx = t +'(' +str(x) +', ' +str(y) +')'
- write(' '+tx, True, "left", ("Consolas", 10, "normal"))
- def spoji (X, Y) :
- x, y = T[X]; up(); goto (x*n, y*n)
- x, y = T[Y]; pd(); goto (x*n, y*n)
- X = T[X]; Y = T[Y]
- X = complex (X[0], X[1]); Y = complex (Y[0], Y[1])
- return round (abs(X-Y), 2)
- ht()
- up(); goto(-5*n, 0); pd(); goto(5*n, 0)
- up(); goto(0, -5*n); pd(); goto(0, 5*n)
- T = {}
- T['A'] = input ('Koordinate točke A ')
- T['B'] = input ('Koordinate točke B ')
- T['C'] = input ('Koordinate točke C ')
- prikazi ('A'); prikazi('B'); prikazi ('C')
- c = spoji ('A', 'B'); a = spoji ('B', 'C'); b = spoji ('C', 'A')
- O = a +b +c; s = O/2; P = (s*(s-a)*(s-b)*(s-c))**0.5
- print 'O =', O, 'P =', P
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement