The process of using Python 3.x to pythonchallenge-----14

Source: Internet
Author: User

Http://www.pythonchallenge.com/pc/return/italy.html




<!--remember:100*100 = (100+99+99+98) + (...  -

③ page There is a wire.png picture, parsing the image of the pixel is not 1*10000

  analysis test instructions, press 2 to decompose the picture in 3, and then press a picture meaning, rotate it to save in the picture ... such as: The 100th pixel, placed on the top row, 第100-199 on the rightmost column ... 

solving process:
From PIL import image# the second picture given on the page wire.png is a 10000*1 picture, is to change to a 100*100 diagram, # Change the way and bread, around the circle, for example, first to the right to walk 100 steps, and then walk down 99 steps, # Then walk 99 steps to the left and walk up 98 steps, so that a lap is complete. Path = U './other/wire.png ' img = image.open (path) imnew=image.new (' RGB ', (100,100), color= (255,255,255)) #imnew. Show () num = 100a = 100counta = 0for I in range: if a > 0:b = c = A-1 D = a-2 #listaa = [A, b , C,d] #crop参数为 (left, upper, right, lower #a Boxa = (counta,0,counta+a,1) Re, upper and lower coordinates (not including lower right)) Gion=img.crop (Boxa) imnew.paste (region, (I, i)) #b Boxb = (counta+a,0,counta+a+b,1) region=img        . Crop (boxb) region = Region.transpose (image.rotate_270) imnew.paste (region, (100-i-1,i+1)) #d        Boxc = (counta+a+b,0,counta+a+b+c,1) region=img.crop (boxc) region = Region.transpose (image.rotate_180)         Imnew.paste (region, (I, 100-i-1)) #d Boxd = (counta+a+b+c,0,counta+a+b+c+d,1) region=img.crop (BOXD) Region = RegiOn.transpose (image.rotate_90) imnew.paste (region, (I, i+1)) CountA = Counta+a + B + C + d A = A-2im New.show ()

Answer: Cat

The process of using Python 3.x to pythonchallenge-----14

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.