Rewrite Program 52 to use an if with an else.

What will be an ideal response?


```
def posterize(picture):
#loop through the pixels
for p in getPixels(picture):
#get the RGB values red = getRed(p) green = getGreen(p) blue = getBlue(p)
red = getRed(p)
green = getGreen(p)
blue = getBlue(p)
#check and set red values if(red < 64):
if(red > 63 and red < 128):
setRed(p, 95)
elif(red > 127 and red < 192):
setRed(p, 159)
elif(red > 191 and red < 256):
setRed(p, 223)
else:
setRed(p, 31)
#check and set green values if(green < 64):
if(green > 63 and green < 128):
setGreen(p, 95)
elif(green > 127 and green < 192):
setGreen(p, 159)
elif(green > 191 and green < 256):
setGreen(p, 223)
else:
setGreen(p, 31)
#check and set blue values if(blue < 64):
if(blue > 63 and blue < 128):
setBlue(p, 95)
elif(blue > 127 and blue < 192):
setBlue(p, 159)
elif(blue > 191 and blue < 256):
setBlue(p, 223)
else:
setBlue(p, 31)
```

Computer Science & Information Technology

You might also like to view...

_______ is a protocol standard for exchanging files over the Internet or an intranet

a. Http b. Https c. RDP d. FTP

Computer Science & Information Technology

Before finalizing the algorithm for a computer program, you should perform a(n) __________ to verify that your algorithm works.?

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

What is the Microsoft Management Console?

What will be an ideal response?

Computer Science & Information Technology

An __________ is a server computer that negotiates the use of a specific EAP method with an EAP peer, validates the EAP peer’s credentials, and authorizes access to the network.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology