Question: Create a function in Python named getpoints that takes in as an argument a string and returns a list of points of arbitrary length.
Create a function in Python named getpoints that takes in as an argument a string and returns a list of points of arbitrary length. The string passed to the function contains pairs of numbers separated by commas, with each pair separated by a space, as shown in the format below. Have the function convert it to a list of points (the polygon's vertices). Each element in the list of points should itself be a list of one point. For example: input: 3,4 5,6 9,5 12,8 5,11 output: [[3, 4], [5, 6], [9, 5], [12, 8], [5, 11]]
Step by Step Solution
There are 3 Steps involved in it
To solve this problem we will define a function getpoints that takes a string of commaseparated ... View full answer
Get step-by-step solutions from verified subject matter experts
