Sort by

recency

|

399 Discussions

|

  • + 0 comments

    import re p=r'[#][0-9A-Fa-f]{3,6}' s='' for i in range(int(input())): s+=input() x=list(re.findall(r'[{][^{}]+[}]',s)) l=[] for i in x: l+=list(re.findall(p,i)) for i in l: print(i)

  • + 0 comments

    import re N = int(input()) A = [] for i in range(N): A.append(input()) text = ''.join(A).replace(" ",'') #To Replace all the white spaces pattern = r'#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})(?!{)\b' # codes = re.findall(pattern, text) for code in list(codes): print(code)

  • + 1 comment
    import re
    N=int(input())
    pattern =r'(\#[0-9a-fA-F]{3,6})(;|,|.;)'
    texto=""
    for _ in range (N):
        texto =texto+''.join(input())
    
    matches =re.findall(pattern,texto)
    
    for match in matches:
        print(match[0])
    
  • + 0 comments

    Here is HackerRank Hex Color Code in Python solution - https://programmingoneonone.com/hackerrank-hex-color-code-solution-in-python.html

  • + 0 comments
    1. import re
    2. def check(x):
    3. matches = re.findall(r"#(?:[a-fA-f0-9]{3}|[a-fA-f0-9]{6})(?=[;|,|)])",x)
    4. if matches:
    5. print('\n'.join(matches))