Thread: Error? Help?

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    Error? Help?


    PHP Code:
     file pickAFile()
          
    picture1 makePicture(file)
          
    pixels=getPixels(picture1)
          
    show(picture1)
          
    pick=str(raw_input("Please enter which two colors you want to swap. R=Red, G=Green, B=Blue.(comma between letters)"))
          
    choice"R,G" or "r,g" or "G,B" or "g'b" or "R,B" or "r,b" or "G,R" or "g,r" or "B,G" or "b,g" or "B,R" or "b,r"
          
    for i in pixels :
           
    R=getRed(i)
           
    G=getGreen(i)
           
    B=getBlue(i)
           if 
    choice== "R,G" or "r,g" or "G,R" or "g,r" :
             
    setRed(i,G)
             
    setGreen(i,R)
          
    repaint(picture1)
           
    elif choice=="G,B" or "g,b" or "B,G" or "b,g"  :
               
    setGreen(i,B)
               
    setBlue(i,G)
               
    show(picture1)
          
    repaint(picture1)
           
    elif choice=="R,B" or "r,b" or "B,R" or "b,r"  :
               
    setBlue(i,R)
               
    setRed(i,B)
               
    show(picture1)
          
    repaint(picture1


    i am getting error with the elif statement? why? how can i fix it.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    2
    Rep Power
    0

    i really need this quick?


    please help anyone?
  4. #3
  5. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,709
    Rep Power
    480
    wrong indentation.
    [code]Code tags[/code] are essential for python code and Makefiles!
  6. #4
  7. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Norcross, GA (again)
    Posts
    1,804
    Rep Power
    1569
    Aside from the indentation being off, your conditionals are incorrect. If you want to compare a value against a group of values, you need to use a list and the in operator:
    Python Code:
    file = pickAFile()
    picture1 = makePicture(file)
    pixels=getPixels(picture1)
    show(picture1)
    pick=str(raw_input("Please enter which two colors you want to swap. R=Red, G=Green, B=Blue.(comma between letters)"))
    choice = pick.upcase()
    for i in pixels :
         R=getRed(i)
         G=getGreen(i)
         B=getBlue(i)
         if choice in ["R,G", "G,R"]:
             setRed(i,G)
             setGreen(i,R)
         elif choice in ["G,B", "B,G"]:
             setGreen(i,B)
             setBlue(i,G)
         elif choice in ["R,B", "B,R"]:
             setBlue(i,R)
             setRed(i,B)
     
         show(picture1)
         repaint(picture1)
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in Short Understanding the C/C++ Preprocessor
    Taming Python A Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov
  8. #5
  9. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,709
    Rep Power
    480
    Hammodi emphasized "quick" rather than "useful".
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo