Python Turtle Program- Create a program that outputs the correct quadrant given
ID: 3890916 • Letter: P
Question
Python Turtle Program- Create a program that outputs the correct quadrant given an angle measure entered from the keyboard. The program must ask the user to to input an anglenumber (in degrees) and then it should output to the screen which quadrant that angle lies in. Note that any angles which are exact multiples of 90o are not “in” any quadrant; rather, the output should identify which two quadrants are divided at that angle. (For example, an input of 180o should result in a response that it is between quadrants 2 and 3.) After the program receives an input from the user and reports in which quadrant that angle lies, it should ask for another input. If the user enters a single period (“.”) that signals the end of the program and it should exit. Please provide source code and output. Thanks
Explanation / Answer
Hi, here is the fully executable code with comments,
# Hello World program in Python
angle = int(input('Enter an angle:')) //taking input
while(1):
if(angle%90==0): //checking for middle constraint
print ("angle is between Q{0} and Q{1}".format(angle/90))
/* checking for angle range */
elif(angle<90):
print(" angle is in Q1")
elif(angle<180):
print(" angle is in Q2")
elif(angle<270):
print(" angle is in Q3")
elif(angle<360):
print(" angle is in Q4")
x=string(input("want to test for other angles if not press '.'?")) //taking next test input
if(x=='.'):
break
Thumbs up if this was helpful, otherwise let me know in comments
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.