Compare the Triplets

Sort by

recency

|

4349 Discussions

|

  • + 0 comments

    Custom merchandise creates lasting impressions by turning everyday items into powerful branding tools. Whether it’s custom t-shirts, mugs, or tech accessories, these products help businesses stay memorable. Compare the triplets of quality, creativity, and utility—custom gear wins on all fronts. It not only promotes your brand but also builds loyalty. Elevate your marketing strategy with thoughtful merchandise that speaks volumes and keeps your message in customers’ hands every day.

  • + 0 comments

    Locksmith Bradford delivers prompt, professional service for all your security needs. From emergency lockouts to lock replacements and security upgrades, skilled technicians are available 24/7 to assist homeowners, businesses, and vehicle owners. With years of experience and modern tools, they guarantee quick access without damage. Serving the Bradford area with pride, they offer trustworthy, efficient, and affordable solutions—giving you peace of mind whenever you're in a bind or facing a lock issue.

  • + 0 comments

    Locksmith services are essential for keeping your property safe and accessible. Whether it’s an emergency lockout, a broken key, or a full security upgrade, a professional locksmith offers fast, reliable solutions. Skilled in handling residential, commercial, and vehicle locks, they ensure minimal damage and maximum efficiency. Available 24/7, they respond swiftly when you need them most, restoring access and peace of mind with expert care and dependable service every time.

  • + 0 comments

    Here's my shortest answer (so far)…

    def compareTriplets(a, b):
        return (list(map(sum, zip(*(
          (1, 0) if i > j else (0, 1)
          for i, j in zip(a, b) if i != j))))
          or [0, 0])
    

    Also short, but done without for loop…

    def compareTriplets(a, b):
        return list(map(sum, zip(*(map(lambda i:
            (1, 0) if i[0] > i[1] else (0, 1) if i[0] < i[1] else (0, 0),
            zip(a, b))))))
    

    I'm not sure whether the for in a sequence comprehension is really considered to be the same as a for-loop, but I thought I'd try to make a solution without that keyword anyway.

    Yesterday, I had submitted this longer answer because I was sleepy…

    def compareTriplets(a, b):
        at = bt = 0
        for i in range(3):
          if a[i] > b[i]:
            at += 1
          if b[i] > a[i]:
            bt += 1
        return [at, bt]
    
  • + 0 comments
    def compareTriplets(a, b):
        sa=0
        sb=0
        for i in range(3):
            if a[i]<b[i]:
                sb+=1
            if a[i]>b[i]:
                sa+=1
            if a[i]==b[i]:
                sa+=0
                sb+=0
        return sa,sb