Sort by

recency

|

397 Discussions

|

  • + 0 comments
    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))
  • + 0 comments
    1. `python
    2. import re
      1. def check(x):
    3. matches = re.findall(r"#(?:[a-fA-f0-9]{3}|[a-fA-f0-9]{6})(?=[;|,|)])",x)
    4. if matches:
    5. for i in range(len(matches)):
    6. print(matches[i])
    7. for i in range(int(input())):
    8. x = input()
    9. check(x)
    10. 14.
  • + 0 comments
    • import re
    • import string
    • jinx = []
    • powder = []
    • p = r'#[0-9a-fA-F]{3}(?:[0-9a-fA-F]{3})?\b'
    • for _ in range(int(input())):
    • inpt = input()
    • if ';' in inpt:
    • isha = re.findall(p,inpt)
    • jinx.append(isha)
    • for pow in jinx:
    • for color in pow:
    • powder.append(color)
    • print('\n'.join(powder))