Rewrite Program 52 (page 124) to use an if with an else. Data from Program 52 def
Question:
Rewrite Program 52 (page 124) to use an if with an else.
Data from Program 52
Transcribed Image Text:
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) %3D %3! #check and set red values if(red < 64): setRed (p, 31) if(red > 63 and red < 128): setRed (p, 95) if(red > 127 and red < 192): setRed (p, 159) if(red > 191 and red < 256): setRed (p, 223) #check and set green values if(green < 64): setGreen (p, 31) if(green > 63 and green < 128): setGreen (p, 95) if(green > 127 and green < 192): setGreen (p, 159) if(green > 191 and green < 256): setGreen (p, 223) #check and set blue values if(blue < 64) : setBlue (p, 31) if(blue > 63 and blue < 128): setBlue (p, 95) if(blue > 127 and blue < 192): setBlue (p, 159) if(blue > 191 and blue < 256): setBlue (p, 223)
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 80% (5 reviews)
def posterizepicture loop through the pixels for p in getPixelspictur...View the full answer
Answered By
FREDRICK MUSYOKI
Professional Qualities:
Solution-oriented.
Self-motivated.
Excellent problem-solving and critical thinking skills.
Good organization, time management and prioritization.
Efficient troubleshooting abilities.
Tutoring Qualities:
I appreciate students as individuals.
I am used to tailoring resources for individual needs.
I can integrate IT into student's lessons.
I am good at explaining concepts.
I am able to help students progress.
I have a wide curriculum knowledge.
5.00+
1+ Reviews
10+ Question Solved
Related Book For
Introduction To Computing And Programming In Python A Multimedia Approach
ISBN: 9780134025544
4th Edition
Authors: Mark J. Guzdial, Barbara Ericson
Question Posted:
Students also viewed these Computer science questions
-
To review chapter content related to each set of exercises, refer to the indicated Learning Objective. Revising Messages: Clarity Break the following sentences into shorter ones; revise as necessary...
-
After doing many follow-up interviews with Dot Matricks, Anna tells Chip, Ive determined the logic needed to update the PENDING COMPUTER ORDERS data store. Because many computers may be ordered on...
-
Data A.1 on page 136 introduces a study in which mice that had a light on at night (rather than complete darkness) ate most of their calories when they should have been resting. These mice gained a...
-
Introduction to Accounting An Integrated Approach EighthEdition Chapter 5 P5.10 P5.10 Engelhaupt Company is considering a switch to JIT. It has gathered the following data: In addition, Engelhaupt...
-
A room contains air at 30oC and a total pressure of 96.0 kPa with a relative humidity of 75 percent. The partial pressure of dry air is (a) 82.0 kPa (b) 85.8 kPa (c) 92.8 kPa (d) 90.6 kPa (e) 72.0 kPa
-
The Dash Cell Phone Company charges customers a basic rate of $5 per month to send text messages. Additional rates are as follows: The first 100 messages per month, regardless of message length, are...
-
To determine optimum condition for a circuit board, the effects of bond strength of FR-4 (an insulating substrate) and thickness of copper lamination on the current flow are studied in a \(2 \times...
-
Cypress Corporation has regular taxable income of $170,000 (assume annual gross receipts are greater than $5 million) and a regular tax liability of $49,550 for 2014. The corporation also has tax...
-
Question 1: Assume the following: Units / year = 10 = Tenure new builder Business and technical skills = New builder / Average skill Financial = High risk o Ignore the equity calculations. Carry out...
-
Consider the portion of an excavator shown. At the instant under consideration, the hydraulic cylinder is extending at a rate of 6 in. /sec, which is decreasing at the rate of 2 in. /sec every...
-
Write a function to blend two pictures: 25% of one picture blended with 75% of another.
-
Why do moviemakers use a green or blue screen for special effects instead of a red screen?
-
In the Illinois Lottery, an urn contains balls numbered 152. From this urn, six balls are randomly chosen without replacement. For a \($1\) bet, a player chooses two sets of six numbers. To win, all...
-
XYZ companys annual sales for its products is 5000 units and its average inventory is 500 units. a. Compute the companys inventory turns. b. If XYZ decides to increase its inventory turns, how will...
-
Susan was a one-third partner in Anders Mountain Partners until last month. Last month, she received a cash distribution of \(\$ 25,000\) in "redemption" (i.e., partial liquidation) of half her...
-
What other potential problems may be relevant to the introduction or implementation of performance management?
-
Sales of cars at a local auto dealer total 3000 cars per year. The dealer reports inventory turns of 30 per year. Compute a. Average inventory in the dealers lot b. The length of time the average car...
-
Demand is normally distributed with a mean of 500 and a standard deviation of 200. Newsvendor assumptions hold. The selling price per unit is $400, cost per unit is $200, and salvage per unit is $40....
-
As the controller of your chosen company (Netflix, Inc.), compose a memo to the CEO addressing the following scenario: Your biggest customer has just gone bankrupt, and you must inform the CEO how...
-
Draw two scatterplots, one for which r = 1 and a second for which r = 21.
-
Give an implementation of the deque ADT using an array list for storage.
-
Implement a method with signature concatenate(LinkedQueue Q2) for the LinkedQueue class that takes all elements of Q2 and appends them to the end of the original queue. The operation should run in...
-
Implement the clone( ) method for the ArrayStack class. (See Section 3.6 for a discussion of cloning data structures.)
-
What are the advantages of deploying multicast routing protocols like PIM and IGMP in multimedia streaming applications, and how do they optimize bandwidth utilization and reduce network congestion ?
-
2. (10 points) Describe in a few words what the algorithm Foo does and what the algorithm Bar does. Analyze the worst-case running time of each algorithm and express it using "Big-Oh" notation....
-
Let x(t) = u(t+2)-u(t-1) where u(t) = < [1, t>0 0,t <0 (unit step signal) and h(t)=e'u(-t+1). a) Sketch x(t) and h(t). Label all your axes. b) Calculate the convolution y(t) = x(t)* h(t). Simplify...
Study smarter with the SolutionInn App