Question: python coding Read the x and y coordinates of points from the file points 3 . txt into the lists x and y . .
python coding
Read the x and y coordinates of points from the file pointstxt into the lists x and y Make sure you download and save that file into your working folder first, of course.
Create a list of Point objects from those coordinates. Here, you cannot simply type a command to append each Point object to plist explicitly, as we did in Task There are two many points to be exact to type an append command for each. Instead, you need to append them all using a forloop, similar to the forloop in Task This part is the main part for you to figure out!
Here is my code so far
from graphics import
def main:
fileName "pointstxt
infile openfileNamer
x
y
line infile.readline
for xStr in line.split:
xappendfloatxStr
line infile.readline
for yStr in line.split:
yappendfloatyStr
for i in rangelenx:
printfpoint: xiyi
win GraphWinConnecting Dots Melissa Carpenter",
win.setCoords
win.setBackgroundlightyellow
poly.drawwin
poly.setFilllightblue
win.getMouse
win.close
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
