Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import turtle
- def check_if_valid(var):
- while True:
- if var.isdigit():
- break
- else:
- var = input('Enter a valid number ->')
- def get_x_and_y():
- x = input('\'x\' coordinate -> ')
- check_if_valid(x)
- y = input('\'y\' coordinate -> ')
- check_if_valid(y)
- return [int(x),int(y)]
- print('This program will read in 2 points, and draw 2 lines. \n\
- Then it will calculate the acute (smaller) angle \n\
- between the 2 lines you draw.')
- # get coordinates
- print('1st point')
- point1 = get_x_and_y()
- print('2nd point')
- point2 = get_x_and_y()
- # calculates the acute angle
- up = point2[1] - point1[1]
- down = point2[0] - point1[0]
- m = up / down
- '''Aquí el problema! ¿Cómo obtener 2 puntos por cada línea?'''
- # start drawing
- turtle.title('Angle Calculator')
- #multiplicados por 4 para hacer las líneas más grandes.
- turtle.goto(point1[0] * 4, point1[1] * 4) #goes to the first point
- turtle.goto(point2[0] * 4, point1[1] * 4) # goes to the second point
- turtle.done()
Advertisement
Add Comment
Please, Sign In to add comment