3. How many 3 digit numbers are divisible by 17? Write a function to print them and return the sum. (The sum being the sum of the 3 digit numbers that are divisible by 17).
4. Write a program that does the following to an image:
changes black pixels to white and white pixels to black
for non-black and non-white pixels, do the following:
reduce the red by 50% if the value of red is above 200
reduce the red by 20% if the value of red is between 100 (inclusive) and 200 (inclusive)
increase the red by 50% if the value of red is below 100
return the total number of pixels increased or decreased by 50% (not including the black & white pixels)
How did you test your program? How do you know that it works? Show a list of test cases that will ensure that every branch of the program is followed.
Using Jython Envirenment for Student
the Q3: I dont know how to sum the answer
Q4, no idea
#===============E 3======================== # This allow any number you want def dvsble(x,y): for n in range(x,y): sum = 0 if n%17 ==0: x = n sum() print n else: n=n+1 print sum
def color(): pic = makePicture(pickAFile()) for x in range(getWidth(pic)): for y in range(getHeight(pic)): px = getPixel(pic,x,y) color = getColor(px) if getColor(Color(255,255,255)): setColor(color,Color(0,0,0)) elif getColor(0,0,0): getColor(255,255,255) show(pic)