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: 72% (11 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
-
what do you think about wealth and inheritance? How does it perpetuate long ago inequalities and how does it lead to inequalities in contemporary society?
-
P(A) = 0.40, P(B) = 0.10, P(C) = 0.50, P(A and B) = 0.05, P(A and C) = 0.25, P(B and C) = 0.10, P(A and B and C) = 0.03 =
-
1. This case study describes several different strategies for attracting and retaining new employees. On the basis of the four drives described in four drive theory and the needs listed in Maslows...
-
Safa is paid a base salary of $1500 per month and a commission of 6% on all sales over $75,000. Last month, Safa's gross salary was $4440. What were her sales for the month? a$149,000 b$124,000...
-
Kipley Company is a small manufacturing firm located in Pittsburgh, Pennsylvania. The company has a workforce of both hourly and salaried employees. Each employee is paid for hours actually worked...
-
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 is the coordination number of each sphere in (a) A simple cubic cell, (b) A body-centered cubic cell, (c) A face-centered cubic cell? Assume the spheres are all the same?
-
what methods ,to do ,or steps do you need to be sure to address when need to make a change in your organization that will help you navigate the organizational culture related to change? Especially...
-
How do you best receive information? Do you prefer written or oral reports? Shorter or longer briefings or reports? Quantitative or qualitative data? Formal or informal styles? How do you ensure...
-
Continuing with an examination of the laws in the state you've written about in earlier discussions, what state and local statutes exist that address the medical conditions or needs of eligible...
-
1. Think about the various soft drinks that you know from the local market and chose any 3 out of that ( e.g. Coca-Cola, Pepsi, 7-Up, Mirinda Citrus, Saudi Champagne, Shaani, Sun Top & Sun Cola,...
-
Leadership is an integral element in any job, regardless of the work title. However, it is important to recognize that leadership is not just one single skill; instead, success in leadership depends...
-
You and your team are tasked with sorting a hundred metallic samples composed of pure silver (Ag), nickel (Ni), indium (In), or cobalt (Co). The problem is the they all look the same (metallic) and...
-
Consider a game of poker being played with a standard 52-card deck (four suits, each of which has 13 different denominations of cards). At a certain point in the game, six cards have been exposed. Of...
-
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.)
-
Berbice Inc. has a new project, and you were recruitment to perform their sensitivity analysis based on the estimates of done by their engineering department (there are no taxes): Pessimistic Most...
-
#3) Seven years ago, Crane Corporation issued 20-year bonds that had a $1,000 face value, paid interest annually, and had a coupon rate of 8 percent. If the market rate of interest is 4.0 percent...
-
I have a portfolio of two stocks. The weights are 60% and 40% respectively, the volatilities are both 20%, while the correlation of returns is 100%. The volatility of my portfolio is A. 4% B. 14.4%...
Study smarter with the SolutionInn App