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 beardrawing program to read its data from a file
and draw the circles specified to produce the image
of the bear.
Code: bearrevised.pytxt
Download bearrevised.pytxt
Find the part of the code that says "your circles go here".
That is where your changes will go You'll put a filereading
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 linebyline.
You'll need to provide the text file. I've started it
below. Save this text as circles.txt
sienna
sienna
chocolate
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:
xyradius,color
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
