+ 1
why is this code not running
if choice == 1: print("please enter R(Between 0 and 255)") r = int(input()) print("please enter B(Between 0 and 255)") b = int(input()) print("please enter G(Between 0 and 255)") g = int(input()) if -1 < r < 256: if -1 < b < 256: if -1 < g < 256: cOne(r,b,g) else: print("G is out if range.") else: print("B is out of range.") else: print("R is out of range.")
5 Answers
+ 1
put this inside a project ...
0
def cOne(r,b,g):
remainderR = r%16
step2r = int((r-remainderR)/16)
remainderB = b%16
step2b = int((b-remainderB)/16)
remainderG = g%16
step2g = int((g-remainderG)/16)
if step2r == 10:
step2r = str("A")
elif step2r == 11:
step2r = str("B")
elif step2r == 12:
step2r = str("C")
elif step2r == 13:
step2r = str("D")
elif step2r == 14:
step2r = ("E")
elif step2r == 15:
step2r = ("F")
#next thing
#next thing
if remainderR == 10:
remainderR = str("A")
elif remainderR == 11:
remainderR = str("B")
elif remainderR == 12:
remainderR = str("C")
elif remainderR == 13:
remainderR = str("D")
elif remainderR == 14:
remainderR = ("E")
elif remainderR == 15:
remainderR = ("F")
#next thing
if step2b == 10:
step2b = str("A")
elif step2b == 11:
step2b = str("B")
elif step2b == 12:
step2b = str("C")
elif step2b == 13:
step2b = str("D")
elif step2b == 14:
step2b = ("E")
elif step2b == 15:
step2b = ("F")
#next thing
if remainderB == 10:
remainderB = str("A")
elif remainderB == 11:
remainderB = str("B")
elif remainderB == 12:
remainderB = str("C")
elif remainderB == 13:
remainderB = str("D")
elif remainderB == 14:
remainderB = ("E")
elif remainderB == 15:
remainderB = ("F")
#next thing
if step2g == 10:
step2g = str("A")
elif step2g == 11:
step2g = str("B")
elif step2g == 12:
step2g = str("C")
elif step2g == 13:
step2g = str("D")
elif step2g == 14:
step2g = ("E")
elif step2g == 15:
step2g = ("F")
#ggggggggg
if remainderG == 10:
remainderG = str("A")
elif remainderG == 11:
remainderG = str("B")
elif remainderG == 12:
remainderG = str("C")
elif remainderG == 13:
remainderG = str("D")
elif remainderG == 14:
remainderG = str("E")
elif remainderG == 15:
remainderG = str("F")
return (print(step2r,remainderR,step2b,remainderB,step2g,remainderG))
0
Thatâs cOne
0
you are a god of smartness
0
alex speranza no I mean like put this code into a project and post the link to this project here, instead of posting the code directly here. It way harder to debug it this way...
you're looking for help so you should atleast make it easier for the people who want to help you by making the code accessable and give a discription of what your doing together with what's not working (error message) and what you have tried doing ...