Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
IMO, this kata is salvagable so I'll publish a new one and see how community reacts! (Since author long gone)
Very unlikely case, did not consider that. Fixed
The question specifically states that the input may be uppercase or lowercase
I was not aware that conversion between hex and integers needed an additional explanation, especially as they are built-in features of python.
I recommend searching for it online or checking out the Wikipedia page if you are unsure https://en.wikipedia.org/wiki/Hexadecimal
But why
for _ in range(3)
instead of justrandom.randrange(16**6)
?..Random test input is in lowercase, but it's uppercase in the description and fixed tests.
You didn't even tell us how we are supposed to convert? What kind of kata is this lmao?
Your suggestion throws an error, I changed it to the following:
hexstring = "#" + "".join("%02x" % random.randrange(256) for _ in range(3))
and now it works
Thanks :)
You're generating values from
000000
toFFFFFE
.This really should have been
hexstring = "#" + "".join(f"{hex(randrange(256)):02x}" for _ in range(3))
.My bad, fixed.
Thanks for helping!
I missed the "not"... The values should NOT be limited to that range.
I presume he means the Red part of RGB with
R
.However, the randrange function already guarantees values between #10 and #F as
16**5 + 1
is #100001 and16**6 - 1
is #ffffff(Feel free to reopen issue if I misunderstood you in any way)
Good idea, issue has been fixed
Loading more items...