can some now how I can fix the error!? python 3.6 Define a function request_coor
ID: 3591628 • Letter: C
Question
can some now how I can fix the error!?
python 3.6
Define a function request_coordinate that asks the user first for an x and then ay between 0 and 4 inclusive) then creates and returns an instance of Coordinate with the entered values. This function has no parameters. Use "while loops to ensure that x and y are both between 0 and 4. Your function should keep asking the user for an acceptable x value until one is entered, and then keep asking the user for an acceptable y value until one is entered. You may assume the user enters integers: if the user enters something other than an integeryour code need not behave sensibly. Be sure to cast to int! No assertEqual tests will be required for this function (though you should test it in idle) Answer: 1- def request_coordinateO: C-CoordinateO v1=int(input) 4 if v1==0: v1-0 6, while (v1 >=4) or (v1-0): vlint(inputO) 10 while v1-4 or v1 C. XV1 C.y=v2 return c CheckExplanation / Answer
def request_coordinate():
x = -1
while (x < 0 or x > 4):
x = int(input())
y = -1
while (y < 0 or y > 4):
y = int(input())
c = Coordinate()
c.x = x
c.y = y
return c
# code link : https://paste.ee/p/J5EbW
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.