Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Author: Jacob Christian
- ## Date: 02/21/2018
- print('This program draws parallelograms')
- width = int(input('How wide would you like '+ #Grabs width
- 'the parallelogram (from 10-300)? '))
- while True:
- if width < 10 or width > 300:
- width = int(input('Number out of range. '+ #Validation Check
- 'Please re-enter your width. ' )) #for width
- else:
- break
- height = int(input('How tall would you like '+ #Grabs height
- 'the parallelogram (from 10-300)? '))
- while True:
- if height < 10 or height > 300:
- height = int(input('Number out of range. '+ #Validation Check
- 'Please re-enter your width. ' )) #for height
- else:
- break
- print('What angle would you like (from 1-179)? ') #Grabs angle
- print('(Note: Your angle input will be the angle on the '+
- 'bottom left and top right)')
- angle_a = int(input(''))
- while True:
- if angle_a < 1 or angle_a > 179:
- angle_a = int(input('Number out of range. '+ #Validation Check
- 'Please re-enter your angle. ')) #for angle
- elif angle_a == 90:
- angle_a = int(input('That makes a box. '+
- 'Please re-enter your angle. ')) #Box check
- else:
- break
- angle_b = 180-angle_a #converts adjacent
- #angle
- import turtle
- turtle.hideturtle()
- turtle.penup() #removes line draw
- turtle.setposition(-200,0) #Sets head
- turtle.pendown() #adds line draw
- #loops to make 2 passes
- for i in range(2):
- turtle.forward(width) #moves (width)
- turtle.left(angle_a) #shifts angle
- turtle.forward(height) #moves (height)
- turtle.left(angle_b) #shifts 180 - angle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement