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
-
Duval Manufacturing recently reported the following information: Net income......................................$ 600,000 ROA.....................................................8% Interest...
-
What decision-making errors might Major League Baseball fall victim to as it tries to improve the game for its fans?
-
PROJECT STEPS 1. Lizzy is the manager of Cozy Movies, a small local movie theater that has been in business for a very long time. She would like to keep track of the theater's sales and expenses from...
-
discuss the implications of geopolitical shifts, such as the rise of multipolarity and the decline of traditional power structures, on the dynamics of global governance and diplomatic relations?
-
The Brunswick Research Organization surveyed 50 randomly selected individuals and asked them the primary way they received the daily news. Their choices were via newspaper (N), television (T), radio...
-
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?
-
What duty of care is owed a trespasser? a. What are the four exceptions to this general rule?
-
Discuss how elasticity meaningfully differs from the derivative in DEA.
-
ITGCs are important because they: a. promote the reliability of electronic audit evidence. b. affect the effectiveness of both application controls and IT-dependent manual controls. c. prevent...
-
What is the minimum pressure required to desalinate seawater by reverse osmosis?
-
An auditor performs an analytical procedure and calculates an expected interest expense for the client using the average debt outstanding, the weighted average interest rate, and the payment dates....
-
Analytical procedures: a. are only done during the risk assessment phase of the audit. b. are substantive procedures and cannot be used at any other stage of the audit. c. are used at the risk...
-
Reformulate Exercise 11.2.33 for a mass-spring chain connected to both top and bottom supports. Do the same conclusions hold?
-
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.)
-
4. The average American last year worked 44 hours per week and a population standard deviation of 7 hours. What percentage of people work at least 50 hours per week? What percentage of people work...
-
he ages of first graders on September 1 at Garden Elementary School are uniformly distributed from 5.8 to 7.4 years. a) Find the mean age of first graders at the school on September 1. b) Find the...
-
1. What is R2 (R squared)? 2. What does it measure? How is this relate to X and Y? Pleasebriefly explain. 3. So what, why does anyone care how high or low R2 squared iswhen evaluating a linear...
Study smarter with the SolutionInn App