You are viewing a single comment's thread. Return to all comments →
import re N = int(input()) hex_code = r'#[0-9A-Fa-f]{3,6}(?=[^\w-])' css_colors = [] for _ in range(N): line = input() css_colors.extend(re.findall(hex_code, line)) print('\n'.join(css_colors))
{3,6} doesn't mean 3 OR 6, it means 3–6. I.e., 3, 4, 5, or 6.
{3,6}
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Hex Color Code
You are viewing a single comment's thread. Return to all comments →
{3,6}
doesn't mean 3 OR 6, it means 3–6. I.e., 3, 4, 5, or 6.