Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
Code
Diff
  • returnHundred=()=>100;
  • 1-function returnhundred(){return 'd'.charCodeAt();}
    1+returnHundred=()=>100;
Code
Diff
  • def find_only(values):
        return sorted(set(values), key=lambda x: values.count(x))[0]
  • 1-from collections import Counter
    2-def FindOnly(values):
    3- return Counter(values).most_common()[::-1][0][0]
    1+def find_only(values):
    2+ return sorted(set(values), key=lambda x: values.count(x))[0]
Code
Diff
  • reverseWords=s=>s.split(' ').reverse().join(' ');
  • 1-function reverseWords(str) {
    2- return str.split(" ").reverse().join(" ")
    3-}
    1+reverseWords=s=>s.split(' ').reverse().join(' ');
Code
Diff
  • from collections import Counter
    
    def FindOnly(values):
        items = Counter(values)
        for item in items:
            if items[item] == 1:
                return item
  • 1+from collections import Counter
    2+
    11 def FindOnly(values):
    2- for value in set(values):
    3- if 1 == values.count(value): # check value is unique
    4- return value
    4+ items = Counter(values)
    5+ for item in items:
    6+ if items[item] == 1:
    7+ return item
Code
Diff
  • function returnhundred() {
      return 'd'.charCodeAt();
    }
  • 11 function returnhundred() {
    2- return require('crypto').createHash('sha').update('Robson').digest()[0]
    2+ return 'd'.charCodeAt();
    33 }
Code
Diff
  • def decrypt(code, amount):
        return ''.join([chr((ord(c)-amount+65)%26+65) if c.isalpha() else c for c in code])
  • 1-def decrypt(code,amount):
    2- word = ""
    3- for i in code:
    4- if i==" ":
    5- word+=" "
    6- continue
    7- tmp = ord(i)-amount
    8- if tmp<65:
    9- tmp+=26
    10- word+=chr(tmp)
    11- return word
    1+def decrypt(code, amount):
    2+ return ''.join([chr((ord(c)-amount+65)%26+65) if c.isalpha() else c for c in code])