HackerRank Python - Hex Color Code



CSS colors are defined using a hexadecimal (HEX) notation for the combination of Red, Green, and Blue color values (RGB).



  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. import re
  3. for _ in range(int(input())):
  4. matches = re.findall(r':?.(#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3})', input())
  5. if matches:
  6. print(*matches, sep='\n')

download android app