task_id
stringlengths
36
40
entry_point
stringclasses
158 values
prompt
stringlengths
116
1.98k
suffix
stringclasses
839 values
canonical_solution
stringlengths
6
859
test
stringclasses
164 values
MultiLineInfilling/HumanEval/143/L3_L6
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
if len(word) == 1: flg = 1 for i in range(2, len(word)): if len(word)%i == 0:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L3_L7
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
if len(word) == 1: flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L3_L8
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
new_lst.append(word) return " ".join(new_lst)
if len(word) == 1: flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L3_L9
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
if len(word) == 1: flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L3_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if len(word) == 1: flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L4_L4
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
flg = 1
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L4_L5
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
flg = 1 for i in range(2, len(word)):
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L4_L6
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
flg = 1 for i in range(2, len(word)): if len(word)%i == 0:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L4_L7
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L4_L8
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
new_lst.append(word) return " ".join(new_lst)
flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L4_L9
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L4_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
flg = 1 for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L5_L5
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
for i in range(2, len(word)):
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L5_L6
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
for i in range(2, len(word)): if len(word)%i == 0:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L5_L7
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
for i in range(2, len(word)): if len(word)%i == 0: flg = 1
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L5_L8
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
new_lst.append(word) return " ".join(new_lst)
for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L5_L9
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L5_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
for i in range(2, len(word)): if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L6_L6
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
if len(word)%i == 0:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L6_L7
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
if len(word)%i == 0: flg = 1
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L6_L8
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
new_lst.append(word) return " ".join(new_lst)
if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L6_L9
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L6_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if len(word)%i == 0: flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L7_L7
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
flg = 1
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L7_L8
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
new_lst.append(word) return " ".join(new_lst)
flg = 1 if flg == 0 or len(word) == 2:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L7_L9
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L7_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
flg = 1 if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L8_L8
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
new_lst.append(word) return " ".join(new_lst)
if flg == 0 or len(word) == 2:
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L8_L9
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
if flg == 0 or len(word) == 2: new_lst.append(word)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L8_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
if flg == 0 or len(word) == 2: new_lst.append(word) return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L9_L9
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
new_lst.append(word)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L9_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
new_lst.append(word) return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/143/L10_L10
words_in_sentence
def words_in_sentence(sentence): """ You are given a string representing a sentence, the sentence contains some words separated by a space, and you have to return a string that contains the words from the original sentence, whose lengths are prime numbers, the order of the words in the new stri...
return " ".join(new_lst)
def check(candidate): # Check some simple cases assert candidate("This is a test") == "is" assert candidate("lets go for swimming") == "go for" assert candidate("there is no place available here") == "there is no place" assert candidate("Hi I am Hussein") == "Hi am Hussein" assert candidate("go...
MultiLineInfilling/HumanEval/144/L0_L0
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
a, b = x.split("/")
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L0_L1
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
a, b = x.split("/") c, d = n.split("/")
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L0_L2
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
a, b = x.split("/") c, d = n.split("/") numerator = int(a) * int(c)
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L0_L3
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
if (numerator/denom == int(numerator/denom)): return True return False
a, b = x.split("/") c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d)
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L0_L4
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return True return False
a, b = x.split("/") c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)):
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L0_L5
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return False
a, b = x.split("/") c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L0_L6
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
a, b = x.split("/") c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L1_L1
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
c, d = n.split("/")
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L1_L2
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
c, d = n.split("/") numerator = int(a) * int(c)
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L1_L3
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
if (numerator/denom == int(numerator/denom)): return True return False
c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d)
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L1_L4
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return True return False
c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)):
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L1_L5
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return False
c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L1_L6
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
c, d = n.split("/") numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L2_L2
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
numerator = int(a) * int(c)
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L2_L3
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
if (numerator/denom == int(numerator/denom)): return True return False
numerator = int(a) * int(c) denom = int(b) * int(d)
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L2_L4
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return True return False
numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)):
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L2_L5
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return False
numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L2_L6
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
numerator = int(a) * int(c) denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L3_L3
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
if (numerator/denom == int(numerator/denom)): return True return False
denom = int(b) * int(d)
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L3_L4
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return True return False
denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)):
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L3_L5
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return False
denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L3_L6
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
denom = int(b) * int(d) if (numerator/denom == int(numerator/denom)): return True return False
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L4_L4
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return True return False
if (numerator/denom == int(numerator/denom)):
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L4_L5
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return False
if (numerator/denom == int(numerator/denom)): return True
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L4_L6
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
if (numerator/denom == int(numerator/denom)): return True return False
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L5_L5
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return False
return True
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L5_L6
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return True return False
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/144/L6_L6
simplify
def simplify(x, n): """Your task is to implement a function that will simplify the expression x * n. The function returns True if x * n evaluates to a whole number and False otherwise. Both x and n, are string representation of a fraction, and have the following format, <numerator>/<denominator> where ...
return False
def check(candidate): # Check some simple cases assert candidate("1/5", "5/1") == True, 'test1' assert candidate("1/6", "2/1") == False, 'test2' assert candidate("5/1", "3/1") == True, 'test3' assert candidate("7/10", "10/2") == False, 'test4' assert candidate("2/10", "50/10") == True, 'test5' ...
MultiLineInfilling/HumanEval/145/L0_L0
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def digits_sum(n):
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L0_L1
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def digits_sum(n): neg = 1
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L0_L2
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def digits_sum(n): neg = 1 if n < 0: n, neg = -1 * n, -1
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L0_L3
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def digits_sum(n): neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)]
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L0_L4
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sum(n) return sorted(nums, key=digits_sum)
def digits_sum(n): neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L0_L5
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sorted(nums, key=digits_sum)
def digits_sum(n): neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L0_L6
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
def digits_sum(n): neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L1_L1
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
neg = 1
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L1_L2
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
neg = 1 if n < 0: n, neg = -1 * n, -1
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L1_L3
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)]
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L1_L4
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sum(n) return sorted(nums, key=digits_sum)
neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L1_L5
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sorted(nums, key=digits_sum)
neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L1_L6
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
neg = 1 if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L2_L2
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
if n < 0: n, neg = -1 * n, -1
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L2_L3
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)]
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L2_L4
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sum(n) return sorted(nums, key=digits_sum)
if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L2_L5
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sorted(nums, key=digits_sum)
if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L2_L6
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
if n < 0: n, neg = -1 * n, -1 n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L3_L3
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
n = [int(i) for i in str(n)]
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L3_L4
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sum(n) return sorted(nums, key=digits_sum)
n = [int(i) for i in str(n)] n[0] = n[0] * neg
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L3_L5
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sorted(nums, key=digits_sum)
n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L3_L6
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n = [int(i) for i in str(n)] n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L4_L4
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sum(n) return sorted(nums, key=digits_sum)
n[0] = n[0] * neg
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L4_L5
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sorted(nums, key=digits_sum)
n[0] = n[0] * neg return sum(n)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L4_L6
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
n[0] = n[0] * neg return sum(n) return sorted(nums, key=digits_sum)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L5_L5
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sorted(nums, key=digits_sum)
return sum(n)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L5_L6
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sum(n) return sorted(nums, key=digits_sum)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/145/L6_L6
order_by_points
def order_by_points(nums): """ Write a function which sorts the given list of integers in ascending order according to the sum of their digits. Note: if there are several items with similar sum of their digits, order them based on their index in original list. For example: >>> order_by_poi...
return sorted(nums, key=digits_sum)
def check(candidate): # Check some simple cases assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] assert candidate([]) == [] assert candidate([1,...
MultiLineInfilling/HumanEval/146/L1_L1
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
for num in nums: if num > 10: odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
count = 0
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L1_L2
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
if num > 10: odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
count = 0 for num in nums:
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L1_L3
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
count = 0 for num in nums: if num > 10:
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L1_L4
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
count = 0 for num in nums: if num > 10: odd_digits = (1, 3, 5, 7, 9)
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L1_L5
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
count = 0 for num in nums: if num > 10: odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num)
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L1_L6
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
count += 1 return count
count = 0 for num in nums: if num > 10: odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits:
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L1_L7
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
return count
count = 0 for num in nums: if num > 10: odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L1_L9
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
count = 0 for num in nums: if num > 10: odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L2_L2
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
if num > 10: odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
for num in nums:
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L2_L3
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
odd_digits = (1, 3, 5, 7, 9) number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
for num in nums: if num > 10:
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...
MultiLineInfilling/HumanEval/146/L2_L4
specialFilter
def specialFilter(nums): """Write a function that takes an array of numbers as input and returns the number of elements in the array that are greater than 10 and both first and last digits of a number are odd (1, 3, 5, 7, 9). For example: specialFilter([15, -73, 14, -15]) => 1 specialFilter(...
number_as_string = str(num) if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: count += 1 return count
for num in nums: if num > 10: odd_digits = (1, 3, 5, 7, 9)
def check(candidate): # Check some simple cases assert candidate([5, -2, 1, -5]) == 0 assert candidate([15, -73, 14, -15]) == 1 assert candidate([33, -2, -3, 45, 21, 109]) == 2 assert candidate([43, -12, 93, 125, 121, 109]) == 4 assert candidate([71, -2, -33, 75, 21, 19]) == 3 # Check s...