he66666
  • he66666
Help on python: If the function name is "widen", with the parameter "picture" and the return type being a picture, return a new picture that is twice as wide as the given picture. For each pixel (x, y) in the original picture, the pixels (2 * x, y) and (2 * x + 1, y) in the new picture should be set to the same color as it. Can someone please help me? I cant seem to do this. (btw, we cannot use the PIL)
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
rsmith6559
  • rsmith6559
xy coordinates suggest a list of lists as the data structure. For all the color datum in the horizontal, just add it twice to the horizontal of a new list of lists.
he66666
  • he66666
Yes I understand that but I don't get how you would set the function. I'm a beginner at Python so I don't know how to set the function properly. I also don't get why in the question 1 is added to 2*x in the x-coordinate?
rsmith6559
  • rsmith6559
TBH, ( 2 * x, y ) suggests to me that the image becomes two images side by side. If you just want to distort the image to be twice as wide, reading ( x, y ) from the input picture and writing x to ( x, y ) and ( x +1, y ) in a new image ( to be returned from the function ) will make it twice as wide. The Python syntax for a function would be: def widen( inputPicture ): # make the new picture return( outputPicture ) And would be called something like: fatPicture = widen( thinPicture ) I don't know what else to say without writing the code for you without a more specific question.

Looking for something else?

Not the answer you are looking for? Search for more explanations.