I have a list of values that looks like this:
15,100,25.0
-50,-50,50.0
-20,120,70,40
200,-100,25,5
The first two lines represent values for a circle, the third for a rectangle and the fourth for a polygon. I would like the output to look like this:
c 15,100,25.0
c -50,-50,50.0
r -20,120,70,40
p 200,-100,25,5
I'm not sure how I can add the letter for each of the lines. I have a for-loop that I'm using to go through the information in the string to print them out.
for shapes in list_of_shapes:
print(",".join(str(item) for item in shapes))
Here's some of my code:
list_of_shapes = []
while p >= 0:
#Here is a bunch of code
list_of_shapes.append("c")
list_of_shapes.append(circle) # appends the data for the circles
while p2 >= 0:
#bunch of code
list_of_shapes.append("r")
list_of_shapes.append(rect) # appends the data for the rectangle
while p3 >= 0:
#code
list_of_shapes.append("p")
list_of_shapes.append(poly) # appends the data for the polygon
return list_of_shapes
Once I do this for all of them, I end up getting:
c
15,100,25.0
c
-50,-50,50.0
r
-20,120,70,40
p
200,-100,25,5
Any help would be greatly appreciated :)