task_name
stringclasses 1
value | src_lang
stringclasses 1
value | tgt_lang
stringclasses 1
value | data_id
stringlengths 10
12
| demos
listlengths 0
0
| compare_func
listlengths 0
0
| dataset_name
stringclasses 1
value | suffix
stringlengths 0
672
| test_cases
listlengths 0
5
| entry_func
stringlengths 3
31
| import_str
listlengths 0
1
| doc_string
stringlengths 39
252
| prefix
stringlengths 80
786
| solution
stringlengths 11
142
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
code_infilling
|
python
|
python
|
MBPP/453/L4
|
[] |
[] |
MBPP_Infilling
|
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
|
return 0
|
code_infilling
|
python
|
python
|
MBPP/453/L5
|
[] |
[] |
MBPP_Infilling
|
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
|
res = 1
|
code_infilling
|
python
|
python
|
MBPP/453/L6
|
[] |
[] |
MBPP_Infilling
|
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
|
for i in range(2, int(math.sqrt(n)) + 1):
|
code_infilling
|
python
|
python
|
MBPP/453/L7
|
[] |
[] |
MBPP_Infilling
|
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
|
count = 0
|
code_infilling
|
python
|
python
|
MBPP/453/L8
|
[] |
[] |
MBPP_Infilling
|
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
|
curr_sum = 1
|
code_infilling
|
python
|
python
|
MBPP/453/L9
|
[] |
[] |
MBPP_Infilling
|
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
|
curr_term = 1
|
code_infilling
|
python
|
python
|
MBPP/453/L10
|
[] |
[] |
MBPP_Infilling
|
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
|
while n % i == 0:
|
code_infilling
|
python
|
python
|
MBPP/453/L11
|
[] |
[] |
MBPP_Infilling
|
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
|
count = count + 1
|
code_infilling
|
python
|
python
|
MBPP/453/L12
|
[] |
[] |
MBPP_Infilling
|
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
|
n = n // i
|
code_infilling
|
python
|
python
|
MBPP/453/L13
|
[] |
[] |
MBPP_Infilling
|
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
|
if i == 2 and count == 1:
|
code_infilling
|
python
|
python
|
MBPP/453/L14
|
[] |
[] |
MBPP_Infilling
|
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
|
curr_sum = 0
|
code_infilling
|
python
|
python
|
MBPP/453/L15
|
[] |
[] |
MBPP_Infilling
|
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
|
curr_term = curr_term * i
|
code_infilling
|
python
|
python
|
MBPP/453/L16
|
[] |
[] |
MBPP_Infilling
|
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
|
curr_sum = curr_sum + curr_term
|
code_infilling
|
python
|
python
|
MBPP/453/L17
|
[] |
[] |
MBPP_Infilling
|
if n >= 2:
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
|
res = res * curr_sum
|
code_infilling
|
python
|
python
|
MBPP/453/L18
|
[] |
[] |
MBPP_Infilling
|
res = res * (1 + n)
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
|
if n >= 2:
|
code_infilling
|
python
|
python
|
MBPP/453/L19
|
[] |
[] |
MBPP_Infilling
|
return res
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
|
res = res * (1 + n)
|
code_infilling
|
python
|
python
|
MBPP/453/L20
|
[] |
[] |
MBPP_Infilling
|
[
[
"18",
"26"
],
[
"30",
"48"
],
[
"6",
"8"
]
] |
sumofFactors
|
[
"import math "
] |
Write a python function to find the sum of even factors of a number.
|
import math
def sumofFactors(n):
"""Write a python function to find the sum of even factors of a number. """
if n % 2 != 0:
return 0
res = 1
for i in range(2, int(math.sqrt(n)) + 1):
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0:
count = count + 1
n = n // i
if i == 2 and count == 1:
curr_sum = 0
curr_term = curr_term * i
curr_sum = curr_sum + curr_term
res = res * curr_sum
if n >= 2:
res = res * (1 + n)
|
return res
|
|
code_infilling
|
python
|
python
|
MBPP/454/L3
|
[] |
[] |
MBPP_Infilling
|
if re.search(patterns, text):
return True
else:
return False
|
[
[
"\"pythonz.\"",
"True"
],
[
"\"xyz.\"",
"True"
],
[
"\" lang .\"",
"False"
]
] |
text_match_wordz
|
[
"import re"
] |
Write a function that matches a word containing 'z'.
|
import re
def text_match_wordz(text):
"""Write a function that matches a word containing 'z'. """
|
patterns = '\\w*z.\\w*'
|
code_infilling
|
python
|
python
|
MBPP/454/L4
|
[] |
[] |
MBPP_Infilling
|
return True
else:
return False
|
[
[
"\"pythonz.\"",
"True"
],
[
"\"xyz.\"",
"True"
],
[
"\" lang .\"",
"False"
]
] |
text_match_wordz
|
[
"import re"
] |
Write a function that matches a word containing 'z'.
|
import re
def text_match_wordz(text):
"""Write a function that matches a word containing 'z'. """
patterns = '\\w*z.\\w*'
|
if re.search(patterns, text):
|
code_infilling
|
python
|
python
|
MBPP/454/L5
|
[] |
[] |
MBPP_Infilling
|
else:
return False
|
[
[
"\"pythonz.\"",
"True"
],
[
"\"xyz.\"",
"True"
],
[
"\" lang .\"",
"False"
]
] |
text_match_wordz
|
[
"import re"
] |
Write a function that matches a word containing 'z'.
|
import re
def text_match_wordz(text):
"""Write a function that matches a word containing 'z'. """
patterns = '\\w*z.\\w*'
if re.search(patterns, text):
|
return True
|
code_infilling
|
python
|
python
|
MBPP/454/L6
|
[] |
[] |
MBPP_Infilling
|
return False
|
[
[
"\"pythonz.\"",
"True"
],
[
"\"xyz.\"",
"True"
],
[
"\" lang .\"",
"False"
]
] |
text_match_wordz
|
[
"import re"
] |
Write a function that matches a word containing 'z'.
|
import re
def text_match_wordz(text):
"""Write a function that matches a word containing 'z'. """
patterns = '\\w*z.\\w*'
if re.search(patterns, text):
return True
|
else:
|
code_infilling
|
python
|
python
|
MBPP/454/L7
|
[] |
[] |
MBPP_Infilling
|
[
[
"\"pythonz.\"",
"True"
],
[
"\"xyz.\"",
"True"
],
[
"\" lang .\"",
"False"
]
] |
text_match_wordz
|
[
"import re"
] |
Write a function that matches a word containing 'z'.
|
import re
def text_match_wordz(text):
"""Write a function that matches a word containing 'z'. """
patterns = '\\w*z.\\w*'
if re.search(patterns, text):
return True
else:
|
return False
|
|
code_infilling
|
python
|
python
|
MBPP/455/L1
|
[] |
[] |
MBPP_Infilling
|
return True
else:
return False
|
[
[
"5",
"True"
],
[
"2",
"False"
],
[
"6",
"False"
]
] |
check_monthnumb_number
|
[] |
Write a function to check whether the given month number contains 31 days or not.
|
def check_monthnumb_number(monthnum2):
"""Write a function to check whether the given month number contains 31 days or not. """
|
if monthnum2 == 1 or monthnum2 == 3 or monthnum2 == 5 or (monthnum2 == 7) or (monthnum2 == 8) or (monthnum2 == 10) or (monthnum2 == 12):
|
code_infilling
|
python
|
python
|
MBPP/455/L2
|
[] |
[] |
MBPP_Infilling
|
else:
return False
|
[
[
"5",
"True"
],
[
"2",
"False"
],
[
"6",
"False"
]
] |
check_monthnumb_number
|
[] |
Write a function to check whether the given month number contains 31 days or not.
|
def check_monthnumb_number(monthnum2):
"""Write a function to check whether the given month number contains 31 days or not. """
if monthnum2 == 1 or monthnum2 == 3 or monthnum2 == 5 or (monthnum2 == 7) or (monthnum2 == 8) or (monthnum2 == 10) or (monthnum2 == 12):
|
return True
|
code_infilling
|
python
|
python
|
MBPP/455/L3
|
[] |
[] |
MBPP_Infilling
|
return False
|
[
[
"5",
"True"
],
[
"2",
"False"
],
[
"6",
"False"
]
] |
check_monthnumb_number
|
[] |
Write a function to check whether the given month number contains 31 days or not.
|
def check_monthnumb_number(monthnum2):
"""Write a function to check whether the given month number contains 31 days or not. """
if monthnum2 == 1 or monthnum2 == 3 or monthnum2 == 5 or (monthnum2 == 7) or (monthnum2 == 8) or (monthnum2 == 10) or (monthnum2 == 12):
return True
|
else:
|
code_infilling
|
python
|
python
|
MBPP/455/L4
|
[] |
[] |
MBPP_Infilling
|
[
[
"5",
"True"
],
[
"2",
"False"
],
[
"6",
"False"
]
] |
check_monthnumb_number
|
[] |
Write a function to check whether the given month number contains 31 days or not.
|
def check_monthnumb_number(monthnum2):
"""Write a function to check whether the given month number contains 31 days or not. """
if monthnum2 == 1 or monthnum2 == 3 or monthnum2 == 5 or (monthnum2 == 7) or (monthnum2 == 8) or (monthnum2 == 10) or (monthnum2 == 12):
return True
else:
|
return False
|
|
code_infilling
|
python
|
python
|
MBPP/456/L1
|
[] |
[] |
MBPP_Infilling
|
return result
|
[
[
"['Red', 'Green', 'Blue', 'White', 'Black']",
"['deR', 'neerG', 'eulB', 'etihW', 'kcalB']"
],
[
"['john','amal','joel','george']",
"['nhoj','lama','leoj','egroeg']"
],
[
"['jack','john','mary']",
"['kcaj','nhoj','yram']"
]
] |
reverse_string_list
|
[] |
Write a function to reverse each string in a given list of string values.
|
def reverse_string_list(stringlist):
"""Write a function to reverse each string in a given list of string values. """
|
result = [x[::-1] for x in stringlist]
|
code_infilling
|
python
|
python
|
MBPP/456/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"['Red', 'Green', 'Blue', 'White', 'Black']",
"['deR', 'neerG', 'eulB', 'etihW', 'kcalB']"
],
[
"['john','amal','joel','george']",
"['nhoj','lama','leoj','egroeg']"
],
[
"['jack','john','mary']",
"['kcaj','nhoj','yram']"
]
] |
reverse_string_list
|
[] |
Write a function to reverse each string in a given list of string values.
|
def reverse_string_list(stringlist):
"""Write a function to reverse each string in a given list of string values. """
result = [x[::-1] for x in stringlist]
|
return result
|
|
code_infilling
|
python
|
python
|
MBPP/457/L1
|
[] |
[] |
MBPP_Infilling
|
[
[
"[[1],[1,2],[1,2,3]]",
"[1]"
],
[
"[[1,1],[1,1,1],[1,2,7,8]]",
"[1,1]"
],
[
"[['x'],['x','y'],['x','y','z']]",
"['x']"
]
] |
Find_Min
|
[] |
Write a python function to find the sublist having minimum length.
|
def Find_Min(lst):
"""Write a python function to find the sublist having minimum length. """
|
return min(lst, key=len)
|
|
code_infilling
|
python
|
python
|
MBPP/458/L1
|
[] |
[] |
MBPP_Infilling
|
return area
|
[
[
"10,20",
"200"
],
[
"10,5",
"50"
],
[
"4,2",
"8"
]
] |
rectangle_area
|
[] |
Write a function to find the area of a rectangle.
|
def rectangle_area(l, b):
"""Write a function to find the area of a rectangle. """
|
area = l * b
|
code_infilling
|
python
|
python
|
MBPP/458/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"10,20",
"200"
],
[
"10,5",
"50"
],
[
"4,2",
"8"
]
] |
rectangle_area
|
[] |
Write a function to find the area of a rectangle.
|
def rectangle_area(l, b):
"""Write a function to find the area of a rectangle. """
area = l * b
|
return area
|
|
code_infilling
|
python
|
python
|
MBPP/459/L3
|
[] |
[] |
MBPP_Infilling
|
[
[
"'cAstyoUrFavoRitETVshoWs'",
"'cstyoravoitshos'"
],
[
"'wAtchTheinTernEtrAdIo'",
"'wtchheinerntrdo'"
],
[
"'VoicESeaRchAndreComMendaTionS'",
"'oiceachndreomendaion'"
]
] |
remove_uppercase
|
[
"import re"
] |
Write a function to remove uppercase substrings from a given string.
|
import re
def remove_uppercase(str1):
"""Write a function to remove uppercase substrings from a given string. """
|
return re.sub('[A-Z]', '', str1)
|
|
code_infilling
|
python
|
python
|
MBPP/460/L1
|
[] |
[] |
MBPP_Infilling
|
[
[
"[[1, 2], [3, 4, 5], [6, 7, 8, 9]]",
"[1, 3, 6]"
],
[
"[[1,2,3],[4, 5]]",
"[1,4]"
],
[
"[[9,8,1],[1,2]]",
"[9,1]"
]
] |
Extract
|
[] |
Write a python function to get the first element of each sublist.
|
def Extract(lst):
"""Write a python function to get the first element of each sublist. """
|
return [item[0] for item in lst]
|
|
code_infilling
|
python
|
python
|
MBPP/461/L1
|
[] |
[] |
MBPP_Infilling
|
for i in range(len(str)):
if str[i] >= 'A' and str[i] <= 'Z':
upper_ctr += 1
return upper_ctr
|
[
[
"'PYthon'",
"1"
],
[
"'BigData'",
"1"
],
[
"'program'",
"0"
]
] |
upper_ctr
|
[] |
Write a python function to count the upper case characters in a given string.
|
def upper_ctr(str):
"""Write a python function to count the upper case characters in a given string. """
|
upper_ctr = 0
|
code_infilling
|
python
|
python
|
MBPP/461/L2
|
[] |
[] |
MBPP_Infilling
|
if str[i] >= 'A' and str[i] <= 'Z':
upper_ctr += 1
return upper_ctr
|
[
[
"'PYthon'",
"1"
],
[
"'BigData'",
"1"
],
[
"'program'",
"0"
]
] |
upper_ctr
|
[] |
Write a python function to count the upper case characters in a given string.
|
def upper_ctr(str):
"""Write a python function to count the upper case characters in a given string. """
upper_ctr = 0
|
for i in range(len(str)):
|
code_infilling
|
python
|
python
|
MBPP/461/L3
|
[] |
[] |
MBPP_Infilling
|
upper_ctr += 1
return upper_ctr
|
[
[
"'PYthon'",
"1"
],
[
"'BigData'",
"1"
],
[
"'program'",
"0"
]
] |
upper_ctr
|
[] |
Write a python function to count the upper case characters in a given string.
|
def upper_ctr(str):
"""Write a python function to count the upper case characters in a given string. """
upper_ctr = 0
for i in range(len(str)):
|
if str[i] >= 'A' and str[i] <= 'Z':
|
code_infilling
|
python
|
python
|
MBPP/461/L4
|
[] |
[] |
MBPP_Infilling
|
return upper_ctr
|
[
[
"'PYthon'",
"1"
],
[
"'BigData'",
"1"
],
[
"'program'",
"0"
]
] |
upper_ctr
|
[] |
Write a python function to count the upper case characters in a given string.
|
def upper_ctr(str):
"""Write a python function to count the upper case characters in a given string. """
upper_ctr = 0
for i in range(len(str)):
if str[i] >= 'A' and str[i] <= 'Z':
|
upper_ctr += 1
|
code_infilling
|
python
|
python
|
MBPP/461/L5
|
[] |
[] |
MBPP_Infilling
|
[
[
"'PYthon'",
"1"
],
[
"'BigData'",
"1"
],
[
"'program'",
"0"
]
] |
upper_ctr
|
[] |
Write a python function to count the upper case characters in a given string.
|
def upper_ctr(str):
"""Write a python function to count the upper case characters in a given string. """
upper_ctr = 0
for i in range(len(str)):
if str[i] >= 'A' and str[i] <= 'Z':
upper_ctr += 1
|
return upper_ctr
|
|
code_infilling
|
python
|
python
|
MBPP/462/L1
|
[] |
[] |
MBPP_Infilling
|
return [[]]
result = []
for el in combinations_list(list1[1:]):
result += [el, el + [list1[0]]]
return result
|
[
[
"['orange', 'red', 'green', 'blue']",
"[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]"
],
[
"['red', 'green', 'blue', 'white', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]"
],
[
"['red', 'green', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]"
]
] |
combinations_list
|
[] |
Write a function to find all possible combinations of the elements of a given list.
|
def combinations_list(list1):
"""Write a function to find all possible combinations of the elements of a given list. """
|
if len(list1) == 0:
|
code_infilling
|
python
|
python
|
MBPP/462/L2
|
[] |
[] |
MBPP_Infilling
|
result = []
for el in combinations_list(list1[1:]):
result += [el, el + [list1[0]]]
return result
|
[
[
"['orange', 'red', 'green', 'blue']",
"[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]"
],
[
"['red', 'green', 'blue', 'white', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]"
],
[
"['red', 'green', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]"
]
] |
combinations_list
|
[] |
Write a function to find all possible combinations of the elements of a given list.
|
def combinations_list(list1):
"""Write a function to find all possible combinations of the elements of a given list. """
if len(list1) == 0:
|
return [[]]
|
code_infilling
|
python
|
python
|
MBPP/462/L3
|
[] |
[] |
MBPP_Infilling
|
for el in combinations_list(list1[1:]):
result += [el, el + [list1[0]]]
return result
|
[
[
"['orange', 'red', 'green', 'blue']",
"[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]"
],
[
"['red', 'green', 'blue', 'white', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]"
],
[
"['red', 'green', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]"
]
] |
combinations_list
|
[] |
Write a function to find all possible combinations of the elements of a given list.
|
def combinations_list(list1):
"""Write a function to find all possible combinations of the elements of a given list. """
if len(list1) == 0:
return [[]]
|
result = []
|
code_infilling
|
python
|
python
|
MBPP/462/L4
|
[] |
[] |
MBPP_Infilling
|
result += [el, el + [list1[0]]]
return result
|
[
[
"['orange', 'red', 'green', 'blue']",
"[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]"
],
[
"['red', 'green', 'blue', 'white', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]"
],
[
"['red', 'green', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]"
]
] |
combinations_list
|
[] |
Write a function to find all possible combinations of the elements of a given list.
|
def combinations_list(list1):
"""Write a function to find all possible combinations of the elements of a given list. """
if len(list1) == 0:
return [[]]
result = []
|
for el in combinations_list(list1[1:]):
|
code_infilling
|
python
|
python
|
MBPP/462/L5
|
[] |
[] |
MBPP_Infilling
|
return result
|
[
[
"['orange', 'red', 'green', 'blue']",
"[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]"
],
[
"['red', 'green', 'blue', 'white', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]"
],
[
"['red', 'green', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]"
]
] |
combinations_list
|
[] |
Write a function to find all possible combinations of the elements of a given list.
|
def combinations_list(list1):
"""Write a function to find all possible combinations of the elements of a given list. """
if len(list1) == 0:
return [[]]
result = []
for el in combinations_list(list1[1:]):
|
result += [el, el + [list1[0]]]
|
code_infilling
|
python
|
python
|
MBPP/462/L6
|
[] |
[] |
MBPP_Infilling
|
[
[
"['orange', 'red', 'green', 'blue']",
"[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]"
],
[
"['red', 'green', 'blue', 'white', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]"
],
[
"['red', 'green', 'black', 'orange']",
"[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]"
]
] |
combinations_list
|
[] |
Write a function to find all possible combinations of the elements of a given list.
|
def combinations_list(list1):
"""Write a function to find all possible combinations of the elements of a given list. """
if len(list1) == 0:
return [[]]
result = []
for el in combinations_list(list1[1:]):
result += [el, el + [list1[0]]]
|
return result
|
|
code_infilling
|
python
|
python
|
MBPP/463/L1
|
[] |
[] |
MBPP_Infilling
|
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
|
n = len(arr)
|
code_infilling
|
python
|
python
|
MBPP/463/L2
|
[] |
[] |
MBPP_Infilling
|
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
|
max_ending_here = 1
|
code_infilling
|
python
|
python
|
MBPP/463/L3
|
[] |
[] |
MBPP_Infilling
|
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
|
min_ending_here = 1
|
code_infilling
|
python
|
python
|
MBPP/463/L4
|
[] |
[] |
MBPP_Infilling
|
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
|
max_so_far = 0
|
code_infilling
|
python
|
python
|
MBPP/463/L5
|
[] |
[] |
MBPP_Infilling
|
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
|
flag = 0
|
code_infilling
|
python
|
python
|
MBPP/463/L6
|
[] |
[] |
MBPP_Infilling
|
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
|
for i in range(0, n):
|
code_infilling
|
python
|
python
|
MBPP/463/L7
|
[] |
[] |
MBPP_Infilling
|
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
|
if arr[i] > 0:
|
code_infilling
|
python
|
python
|
MBPP/463/L8
|
[] |
[] |
MBPP_Infilling
|
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
|
max_ending_here = max_ending_here * arr[i]
|
code_infilling
|
python
|
python
|
MBPP/463/L9
|
[] |
[] |
MBPP_Infilling
|
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
|
min_ending_here = min(min_ending_here * arr[i], 1)
|
code_infilling
|
python
|
python
|
MBPP/463/L10
|
[] |
[] |
MBPP_Infilling
|
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
|
flag = 1
|
code_infilling
|
python
|
python
|
MBPP/463/L11
|
[] |
[] |
MBPP_Infilling
|
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
|
elif arr[i] == 0:
|
code_infilling
|
python
|
python
|
MBPP/463/L12
|
[] |
[] |
MBPP_Infilling
|
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
|
max_ending_here = 1
|
code_infilling
|
python
|
python
|
MBPP/463/L13
|
[] |
[] |
MBPP_Infilling
|
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
|
min_ending_here = 1
|
code_infilling
|
python
|
python
|
MBPP/463/L14
|
[] |
[] |
MBPP_Infilling
|
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
|
else:
|
code_infilling
|
python
|
python
|
MBPP/463/L15
|
[] |
[] |
MBPP_Infilling
|
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
|
temp = max_ending_here
|
code_infilling
|
python
|
python
|
MBPP/463/L16
|
[] |
[] |
MBPP_Infilling
|
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
|
max_ending_here = max(min_ending_here * arr[i], 1)
|
code_infilling
|
python
|
python
|
MBPP/463/L17
|
[] |
[] |
MBPP_Infilling
|
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
|
min_ending_here = temp * arr[i]
|
code_infilling
|
python
|
python
|
MBPP/463/L18
|
[] |
[] |
MBPP_Infilling
|
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
|
if max_so_far < max_ending_here:
|
code_infilling
|
python
|
python
|
MBPP/463/L19
|
[] |
[] |
MBPP_Infilling
|
if flag == 0 and max_so_far == 0:
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
|
max_so_far = max_ending_here
|
code_infilling
|
python
|
python
|
MBPP/463/L20
|
[] |
[] |
MBPP_Infilling
|
return 0
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
|
if flag == 0 and max_so_far == 0:
|
code_infilling
|
python
|
python
|
MBPP/463/L21
|
[] |
[] |
MBPP_Infilling
|
return max_so_far
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
|
return 0
|
code_infilling
|
python
|
python
|
MBPP/463/L22
|
[] |
[] |
MBPP_Infilling
|
[
[
"[1, -2, -3, 0, 7, -8, -2]",
"112"
],
[
"[6, -3, -10, 0, 2]",
"180"
],
[
"[-2, -40, 0, -2, -3]",
"80"
]
] |
max_subarray_product
|
[] |
Write a function to find the maximum product subarray of the given array.
|
def max_subarray_product(arr):
"""Write a function to find the maximum product subarray of the given array. """
n = len(arr)
max_ending_here = 1
min_ending_here = 1
max_so_far = 0
flag = 0
for i in range(0, n):
if arr[i] > 0:
max_ending_here = max_ending_here * arr[i]
min_ending_here = min(min_ending_here * arr[i], 1)
flag = 1
elif arr[i] == 0:
max_ending_here = 1
min_ending_here = 1
else:
temp = max_ending_here
max_ending_here = max(min_ending_here * arr[i], 1)
min_ending_here = temp * arr[i]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if flag == 0 and max_so_far == 0:
return 0
|
return max_so_far
|
|
code_infilling
|
python
|
python
|
MBPP/464/L1
|
[] |
[] |
MBPP_Infilling
|
return result
|
[
[
"{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},10",
"False"
],
[
"{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},12",
"True"
],
[
"{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},5",
"False"
]
] |
check_value
|
[] |
Write a function to check if all values are same in a dictionary.
|
def check_value(dict, n):
"""Write a function to check if all values are same in a dictionary. """
|
result = all((x == n for x in dict.values()))
|
code_infilling
|
python
|
python
|
MBPP/464/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},10",
"False"
],
[
"{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},12",
"True"
],
[
"{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},5",
"False"
]
] |
check_value
|
[] |
Write a function to check if all values are same in a dictionary.
|
def check_value(dict, n):
"""Write a function to check if all values are same in a dictionary. """
result = all((x == n for x in dict.values()))
|
return result
|
|
code_infilling
|
python
|
python
|
MBPP/465/L1
|
[] |
[] |
MBPP_Infilling
|
return dict1
|
[
[
"{'c1': 'Red', 'c2': 'Green', 'c3':None}",
"{'c1': 'Red', 'c2': 'Green'}"
],
[
"{'c1': 'Red', 'c2': None, 'c3':None}",
"{'c1': 'Red'}"
],
[
"{'c1': None, 'c2': 'Green', 'c3':None}",
"{ 'c2': 'Green'}"
]
] |
drop_empty
|
[] |
Write a function to drop empty items from a given dictionary.
|
def drop_empty(dict1):
"""Write a function to drop empty items from a given dictionary. """
|
dict1 = {key: value for (key, value) in dict1.items() if value is not None}
|
code_infilling
|
python
|
python
|
MBPP/465/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"{'c1': 'Red', 'c2': 'Green', 'c3':None}",
"{'c1': 'Red', 'c2': 'Green'}"
],
[
"{'c1': 'Red', 'c2': None, 'c3':None}",
"{'c1': 'Red'}"
],
[
"{'c1': None, 'c2': 'Green', 'c3':None}",
"{ 'c2': 'Green'}"
]
] |
drop_empty
|
[] |
Write a function to drop empty items from a given dictionary.
|
def drop_empty(dict1):
"""Write a function to drop empty items from a given dictionary. """
dict1 = {key: value for (key, value) in dict1.items() if value is not None}
|
return dict1
|
|
code_infilling
|
python
|
python
|
MBPP/468/L1
|
[] |
[] |
MBPP_Infilling
|
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
|
n = len(arr)
|
code_infilling
|
python
|
python
|
MBPP/468/L2
|
[] |
[] |
MBPP_Infilling
|
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
|
mpis = arr[:]
|
code_infilling
|
python
|
python
|
MBPP/468/L3
|
[] |
[] |
MBPP_Infilling
|
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
|
for i in range(n):
|
code_infilling
|
python
|
python
|
MBPP/468/L4
|
[] |
[] |
MBPP_Infilling
|
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
|
current_prod = arr[i]
|
code_infilling
|
python
|
python
|
MBPP/468/L5
|
[] |
[] |
MBPP_Infilling
|
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
|
j = i + 1
|
code_infilling
|
python
|
python
|
MBPP/468/L6
|
[] |
[] |
MBPP_Infilling
|
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
|
while j < n:
|
code_infilling
|
python
|
python
|
MBPP/468/L7
|
[] |
[] |
MBPP_Infilling
|
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
|
if arr[j - 1] > arr[j]:
|
code_infilling
|
python
|
python
|
MBPP/468/L8
|
[] |
[] |
MBPP_Infilling
|
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
|
break
|
code_infilling
|
python
|
python
|
MBPP/468/L9
|
[] |
[] |
MBPP_Infilling
|
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
|
current_prod *= arr[j]
|
code_infilling
|
python
|
python
|
MBPP/468/L10
|
[] |
[] |
MBPP_Infilling
|
mpis[j] = current_prod
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
|
if current_prod > mpis[j]:
|
code_infilling
|
python
|
python
|
MBPP/468/L11
|
[] |
[] |
MBPP_Infilling
|
j = j + 1
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
|
mpis[j] = current_prod
|
code_infilling
|
python
|
python
|
MBPP/468/L12
|
[] |
[] |
MBPP_Infilling
|
return max(mpis)
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
|
j = j + 1
|
code_infilling
|
python
|
python
|
MBPP/468/L13
|
[] |
[] |
MBPP_Infilling
|
[
[
"[3, 100, 4, 5, 150, 6]",
"3000"
],
[
"[4, 42, 55, 68, 80]",
"50265600"
],
[
"[10, 22, 9, 33, 21, 50, 41, 60]",
"2460"
]
] |
max_product
|
[] |
Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array.
|
def max_product(arr):
"""Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
n = len(arr)
mpis = arr[:]
for i in range(n):
current_prod = arr[i]
j = i + 1
while j < n:
if arr[j - 1] > arr[j]:
break
current_prod *= arr[j]
if current_prod > mpis[j]:
mpis[j] = current_prod
j = j + 1
|
return max(mpis)
|
|
code_infilling
|
python
|
python
|
MBPP/470/L1
|
[] |
[] |
MBPP_Infilling
|
return res
|
[
[
"(1, 5, 7, 8, 10)",
"(6, 12, 15, 18)"
],
[
"(2, 6, 8, 9, 11)",
"(8, 14, 17, 20)"
],
[
"(3, 7, 9, 10, 12)",
"(10, 16, 19, 22)"
]
] |
add_pairwise
|
[] |
Write a function to find the pairwise addition of the neighboring elements of the given tuple.
|
def add_pairwise(test_tup):
"""Write a function to find the pairwise addition of the neighboring elements of the given tuple. """
|
res = tuple((i + j for (i, j) in zip(test_tup, test_tup[1:])))
|
code_infilling
|
python
|
python
|
MBPP/470/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"(1, 5, 7, 8, 10)",
"(6, 12, 15, 18)"
],
[
"(2, 6, 8, 9, 11)",
"(8, 14, 17, 20)"
],
[
"(3, 7, 9, 10, 12)",
"(10, 16, 19, 22)"
]
] |
add_pairwise
|
[] |
Write a function to find the pairwise addition of the neighboring elements of the given tuple.
|
def add_pairwise(test_tup):
"""Write a function to find the pairwise addition of the neighboring elements of the given tuple. """
res = tuple((i + j for (i, j) in zip(test_tup, test_tup[1:])))
|
return res
|
|
code_infilling
|
python
|
python
|
MBPP/471/L1
|
[] |
[] |
MBPP_Infilling
|
for i in range(len(arr)):
mul = mul * (arr[i] % n) % n
return mul % n
|
[
[
"[ 100, 10, 5, 25, 35, 14 ],11",
"9"
],
[
"[1,1,1],1",
"0"
],
[
"[1,2,1],2",
"0"
]
] |
find_remainder
|
[] |
Write a python function to find the product of the array multiplication modulo n.
|
def find_remainder(arr, n):
"""Write a python function to find the product of the array multiplication modulo n. """
|
mul = 1
|
code_infilling
|
python
|
python
|
MBPP/471/L2
|
[] |
[] |
MBPP_Infilling
|
mul = mul * (arr[i] % n) % n
return mul % n
|
[
[
"[ 100, 10, 5, 25, 35, 14 ],11",
"9"
],
[
"[1,1,1],1",
"0"
],
[
"[1,2,1],2",
"0"
]
] |
find_remainder
|
[] |
Write a python function to find the product of the array multiplication modulo n.
|
def find_remainder(arr, n):
"""Write a python function to find the product of the array multiplication modulo n. """
mul = 1
|
for i in range(len(arr)):
|
code_infilling
|
python
|
python
|
MBPP/471/L3
|
[] |
[] |
MBPP_Infilling
|
return mul % n
|
[
[
"[ 100, 10, 5, 25, 35, 14 ],11",
"9"
],
[
"[1,1,1],1",
"0"
],
[
"[1,2,1],2",
"0"
]
] |
find_remainder
|
[] |
Write a python function to find the product of the array multiplication modulo n.
|
def find_remainder(arr, n):
"""Write a python function to find the product of the array multiplication modulo n. """
mul = 1
for i in range(len(arr)):
|
mul = mul * (arr[i] % n) % n
|
code_infilling
|
python
|
python
|
MBPP/471/L4
|
[] |
[] |
MBPP_Infilling
|
[
[
"[ 100, 10, 5, 25, 35, 14 ],11",
"9"
],
[
"[1,1,1],1",
"0"
],
[
"[1,2,1],2",
"0"
]
] |
find_remainder
|
[] |
Write a python function to find the product of the array multiplication modulo n.
|
def find_remainder(arr, n):
"""Write a python function to find the product of the array multiplication modulo n. """
mul = 1
for i in range(len(arr)):
mul = mul * (arr[i] % n) % n
|
return mul % n
|
|
code_infilling
|
python
|
python
|
MBPP/472/L1
|
[] |
[] |
MBPP_Infilling
|
[
[
"[1,2,3,4,5]",
"True"
],
[
"[1,2,3,5,6]",
"False"
],
[
"[1,2,1]",
"False"
]
] |
check_Consecutive
|
[] |
Write a python function to check whether the given list contains consecutive numbers or not.
|
def check_Consecutive(l):
"""Write a python function to check whether the given list contains consecutive numbers or not. """
|
return sorted(l) == list(range(min(l), max(l) + 1))
|
|
code_infilling
|
python
|
python
|
MBPP/473/L1
|
[] |
[] |
MBPP_Infilling
|
return res
|
[
[
"[(3, 4), (5, 6), (9, 10), (4, 5)] , [(5, 4), (3, 4), (6, 5), (9, 11)]",
"{(4, 5), (3, 4), (5, 6)}"
],
[
"[(4, 1), (7, 4), (11, 13), (17, 14)] , [(1, 4), (7, 4), (16, 12), (10, 13)]",
"{(4, 7), (1, 4)}"
],
[
"[(2, 1), (3, 2), (1, 3), (1, 4)] , [(11, 2), (2, 3), (6, 2), (1, 3)]",
"{(1, 3), (2, 3)}"
]
] |
tuple_intersection
|
[] |
Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order.
|
def tuple_intersection(test_list1, test_list2):
"""Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order. """
|
res = set([tuple(sorted(ele)) for ele in test_list1]) & set([tuple(sorted(ele)) for ele in test_list2])
|
code_infilling
|
python
|
python
|
MBPP/473/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"[(3, 4), (5, 6), (9, 10), (4, 5)] , [(5, 4), (3, 4), (6, 5), (9, 11)]",
"{(4, 5), (3, 4), (5, 6)}"
],
[
"[(4, 1), (7, 4), (11, 13), (17, 14)] , [(1, 4), (7, 4), (16, 12), (10, 13)]",
"{(4, 7), (1, 4)}"
],
[
"[(2, 1), (3, 2), (1, 3), (1, 4)] , [(11, 2), (2, 3), (6, 2), (1, 3)]",
"{(1, 3), (2, 3)}"
]
] |
tuple_intersection
|
[] |
Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order.
|
def tuple_intersection(test_list1, test_list2):
"""Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order. """
res = set([tuple(sorted(ele)) for ele in test_list1]) & set([tuple(sorted(ele)) for ele in test_list2])
|
return res
|
|
code_infilling
|
python
|
python
|
MBPP/474/L1
|
[] |
[] |
MBPP_Infilling
|
return str2
|
[
[
"\"polygon\",'y','l'",
"(\"pollgon\")"
],
[
"\"character\",'c','a'",
"(\"aharaater\")"
],
[
"\"python\",'l','a'",
"(\"python\")"
]
] |
replace_char
|
[] |
Write a function to replace characters in a string.
|
def replace_char(str1, ch, newch):
"""Write a function to replace characters in a string. """
|
str2 = str1.replace(ch, newch)
|
code_infilling
|
python
|
python
|
MBPP/474/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"\"polygon\",'y','l'",
"(\"pollgon\")"
],
[
"\"character\",'c','a'",
"(\"aharaater\")"
],
[
"\"python\",'l','a'",
"(\"python\")"
]
] |
replace_char
|
[] |
Write a function to replace characters in a string.
|
def replace_char(str1, ch, newch):
"""Write a function to replace characters in a string. """
str2 = str1.replace(ch, newch)
|
return str2
|
|
code_infilling
|
python
|
python
|
MBPP/475/L3
|
[] |
[] |
MBPP_Infilling
|
sort_counter = x.most_common()
return sort_counter
|
[
[
"{'Math':81, 'Physics':83, 'Chemistry':87}",
"[('Chemistry', 87), ('Physics', 83), ('Math', 81)]"
],
[
"{'Math':400, 'Physics':300, 'Chemistry':250}",
"[('Math', 400), ('Physics', 300), ('Chemistry', 250)]"
],
[
"{'Math':900, 'Physics':1000, 'Chemistry':1250}",
"[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)]"
]
] |
sort_counter
|
[
"from collections import Counter"
] |
Write a function to sort a dictionary by value.
|
from collections import Counter
def sort_counter(dict1):
"""Write a function to sort a dictionary by value. """
|
x = Counter(dict1)
|
code_infilling
|
python
|
python
|
MBPP/475/L4
|
[] |
[] |
MBPP_Infilling
|
return sort_counter
|
[
[
"{'Math':81, 'Physics':83, 'Chemistry':87}",
"[('Chemistry', 87), ('Physics', 83), ('Math', 81)]"
],
[
"{'Math':400, 'Physics':300, 'Chemistry':250}",
"[('Math', 400), ('Physics', 300), ('Chemistry', 250)]"
],
[
"{'Math':900, 'Physics':1000, 'Chemistry':1250}",
"[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)]"
]
] |
sort_counter
|
[
"from collections import Counter"
] |
Write a function to sort a dictionary by value.
|
from collections import Counter
def sort_counter(dict1):
"""Write a function to sort a dictionary by value. """
x = Counter(dict1)
|
sort_counter = x.most_common()
|
code_infilling
|
python
|
python
|
MBPP/475/L5
|
[] |
[] |
MBPP_Infilling
|
[
[
"{'Math':81, 'Physics':83, 'Chemistry':87}",
"[('Chemistry', 87), ('Physics', 83), ('Math', 81)]"
],
[
"{'Math':400, 'Physics':300, 'Chemistry':250}",
"[('Math', 400), ('Physics', 300), ('Chemistry', 250)]"
],
[
"{'Math':900, 'Physics':1000, 'Chemistry':1250}",
"[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)]"
]
] |
sort_counter
|
[
"from collections import Counter"
] |
Write a function to sort a dictionary by value.
|
from collections import Counter
def sort_counter(dict1):
"""Write a function to sort a dictionary by value. """
x = Counter(dict1)
sort_counter = x.most_common()
|
return sort_counter
|
|
code_infilling
|
python
|
python
|
MBPP/476/L1
|
[] |
[] |
MBPP_Infilling
|
return sum
|
[
[
"[1,2,3]",
"4"
],
[
"[-1,2,3,4]",
"3"
],
[
"[2,3,6]",
"8"
]
] |
big_sum
|
[] |
Write a python function to find the sum of the largest and smallest value in a given array.
|
def big_sum(nums):
"""Write a python function to find the sum of the largest and smallest value in a given array. """
|
sum = max(nums) + min(nums)
|
code_infilling
|
python
|
python
|
MBPP/476/L2
|
[] |
[] |
MBPP_Infilling
|
[
[
"[1,2,3]",
"4"
],
[
"[-1,2,3,4]",
"3"
],
[
"[2,3,6]",
"8"
]
] |
big_sum
|
[] |
Write a python function to find the sum of the largest and smallest value in a given array.
|
def big_sum(nums):
"""Write a python function to find the sum of the largest and smallest value in a given array. """
sum = max(nums) + min(nums)
|
return sum
|
|
code_infilling
|
python
|
python
|
MBPP/477/L1
|
[] |
[] |
MBPP_Infilling
|
[
[
"\"InValid\"",
"\"invalid\""
],
[
"\"TruE\"",
"\"true\""
],
[
"\"SenTenCE\"",
"\"sentence\""
]
] |
is_lower
|
[] |
Write a python function to convert the given string to lower case.
|
def is_lower(string):
"""Write a python function to convert the given string to lower case. """
|
return string.lower()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.