Question: Modify the bear - drawing program to read its data from a file and draw the circles specified to produce the image of the bear.

Modify the bear-drawing program to read its data from a file
and draw the circles specified to produce the image
of the bear.
Code: bear_revised.py.txt
Download bear_revised.py.txt
Find the part of the code that says "your circles go here".
That is where your changes will go. You'll put a file-reading
loop there.
Replace all calls to the circle function with
a loop that reads from a file, to call the circle
function with the specified parameters read from
the file line-by-line.
You'll need to provide the text file. I've started it
below. Save this text as circles.txt
24,52,10,sienna4
76,52,10,sienna4
22,52,8,chocolate3
When done, the bear program opens the circles.txt file,
reads it line by line, and calls the circle function with
the x, y, radius, and color information read from each line
of the file.
The format of the circles.txt data above is:
x,y,radius,color

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!