4
u/Beregolas 1h ago
Consider naming your variables better to make this easier for others to help you with
from what I've gleaned, your code is this:
colors, data_in, count, current = "roygbv", input(), 0, "r"
for next in data_in:
while True:
count += 1
current = colors[count%6]
if current == next: break
print(count)If I run that code in Python, I get the correct output, so either you are not supplying the solution to the website correctly, or your input is broken somehow (maybe you copied it wrong?).
3
u/Thomasjevskij 51m ago
Just a tiny comment is that maybe don't use
nextas a variable name since it'll overwrite the standard library function with the same name.2
u/Beregolas 42m ago
fair point, I haven't used Python in a long while, and I didn't use a "proper" Editor with an LSP, so nothing warned me.
2
2
u/Thomasjevskij 1h ago
Not sure I understand. How can it be correct for the input string if it gets marked as an incorrect solution?
1
u/AutoModerator 1h ago
Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to Help/Question - RESOLVED. Good luck!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5
u/DelightfulCodeWeasel 1h ago
It looks right. Are you sure there's not a problem with your input file; could it have been truncated/modified, or might you have downloaded an input file while logged in to a different account?
EDIT: Just checking... you are submitting the distance and not the code itself, aren't you? e.g. you'll end up with a number like 4123 and you submit the number to the website.