code
stringlengths
14
580
varname
stringlengths
1
25
vartype
stringclasses
13 values
lst = ['3',"11111111"] res = [] for arr in lst: n = sum(int(d)%2==1 for d in arr) res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.") odd_count = res
n
int
lst = ['3',"11111111"] res = [] for arr in lst: n = sum(int(d)%2==1 for d in arr) res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.") odd_count = res
odd_count
list
lst = ['3',"11111111"] res = [] for arr in lst: n = sum(int(d)%2==1 for d in arr) res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.") odd_count = res
res
list
lst = ['3',"11111111"] res = []
lst
list
lst = ['3',"11111111"] res = []
res
list
lst = ['3',"11111111"] res = [] for arr in lst: n = sum(int(d)%2==1 for d in arr)
arr
str
lst = ['3',"11111111"] res = [] for arr in lst: n = sum(int(d)%2==1 for d in arr)
lst
list
lst = ['3',"11111111"] res = [] for arr in lst: n = sum(int(d)%2==1 for d in arr)
n
int
lst = ['3',"11111111"] res = [] for arr in lst: n = sum(int(d)%2==1 for d in arr)
res
list
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0):
max_sum
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0):
num
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0):
nums
list
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0):
s
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0: max_sum = max(-i for i in nums) min_sum = -max_sum minSubArraySum = min_sum
max_sum
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0: max_sum = max(-i for i in nums) min_sum = -max_sum minSubArraySum = min_sum
minSubArraySum
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0: max_sum = max(-i for i in nums) min_sum = -max_sum minSubArraySum = min_sum
min_sum
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0: max_sum = max(-i for i in nums) min_sum = -max_sum minSubArraySum = min_sum
num
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0: max_sum = max(-i for i in nums) min_sum = -max_sum minSubArraySum = min_sum
nums
list
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0: max_sum = max(-i for i in nums) min_sum = -max_sum minSubArraySum = min_sum
s
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum)
max_sum
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum)
num
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum)
nums
list
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum)
s
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0:
max_sum
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0:
num
int
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0:
nums
list
nums = [7] max_sum = 0 s = 0 for num in nums: s += -num if (s < 0): s = 0 max_sum = max(s, max_sum) if max_sum == 0:
s
int
arr = [1,5,2,3,4] sort_array = sorted(sorted(arr), key=lambda x: bin(x)[2:].count('1'))
arr
list
arr = [1,5,2,3,4] sort_array = sorted(sorted(arr), key=lambda x: bin(x)[2:].count('1'))
sort_array
list
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]: n_consonants += 1 if n_consonants == n: result.append(word)
i
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]: n_consonants += 1 if n_consonants == n: result.append(word)
n
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]: n_consonants += 1 if n_consonants == n: result.append(word)
n_consonants
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]: n_consonants += 1 if n_consonants == n: result.append(word)
result
list
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]: n_consonants += 1 if n_consonants == n: result.append(word)
s
str
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]: n_consonants += 1 if n_consonants == n: result.append(word)
word
str
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)):
i
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)):
n
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)):
n_consonants
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)):
result
list
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)):
s
str
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)):
word
str
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]:
i
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]:
n
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]:
n_consonants
int
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]:
result
list
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]:
s
str
s, n = "a b c d e f", 1 result = [] for word in s.split(): n_consonants = 0 for i in range(0, len(word)): if word[i].lower() not in ["a","e","i","o","u"]:
word
str
s, n = "a b c d e f", 1 result = [] for word in s.split():
n
int
s, n = "a b c d e f", 1 result = [] for word in s.split():
result
list
s, n = "a b c d e f", 1 result = [] for word in s.split():
s
str
s, n = "a b c d e f", 1 result = [] for word in s.split():
word
str
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1):
i
int
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1):
vowels
set
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1):
word
str
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i]
get_closest_vowel
str
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i]
i
int
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i]
vowels
set
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i]
word
str
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i] get_closest_vowel = ""
get_closest_vowel
str
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i] get_closest_vowel = ""
i
int
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i] get_closest_vowel = ""
vowels
set
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels: if (word[i+1] not in vowels) and (word[i-1] not in vowels): get_closest_vowel = word[i] get_closest_vowel = ""
word
str
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels:
i
int
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels:
vowels
set
word = "yogurt" if len(word) < 3: get_closest_vowel = "" vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} for i in range(len(word)-2, 0, -1): if word[i] in vowels:
word
str
lst = [')(()', '(()('] def check(s): val = 0 for i in s: if i == '(': val = val + 1 else: val = val - 1 if val < 0: match_parens = False match_parens = True if val == 0 else False S1 = lst[0] + lst[1] S2 = lst[1] + lst[0] match_parens = 'Yes' if check(S1) or check(S2) else 'No'
S1
str
lst = [')(()', '(()('] def check(s): val = 0 for i in s: if i == '(': val = val + 1 else: val = val - 1 if val < 0: match_parens = False match_parens = True if val == 0 else False S1 = lst[0] + lst[1] S2 = lst[1] + lst[0] match_parens = 'Yes' if check(S1) or check(S2) else 'No'
S2
str
lst = [')(()', '(()('] def check(s): val = 0 for i in s: if i == '(': val = val + 1 else: val = val - 1 if val < 0: match_parens = False match_parens = True if val == 0 else False S1 = lst[0] + lst[1] S2 = lst[1] + lst[0] match_parens = 'Yes' if check(S1) or check(S2) else 'No'
check
function
lst = [')(()', '(()('] def check(s): val = 0 for i in s: if i == '(': val = val + 1 else: val = val - 1 if val < 0: match_parens = False match_parens = True if val == 0 else False S1 = lst[0] + lst[1] S2 = lst[1] + lst[0] match_parens = 'Yes' if check(S1) or check(S2) else 'No'
lst
list
lst = [')(()', '(()('] def check(s): val = 0 for i in s: if i == '(': val = val + 1 else: val = val - 1 if val < 0: match_parens = False match_parens = True if val == 0 else False S1 = lst[0] + lst[1] S2 = lst[1] + lst[0] match_parens = 'Yes' if check(S1) or check(S2) else 'No'
match_parens
str
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort() ans = arr[-k:] maximum = ans
ans
list
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort() ans = arr[-k:] maximum = ans
arr
list
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort() ans = arr[-k:] maximum = ans
k
int
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort() ans = arr[-k:] maximum = ans
maximum
list
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort()
arr
list
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort()
k
int
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort() ans = arr[-k:]
ans
list
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort() ans = arr[-k:]
arr
list
arr, k = [-3, 2, 1, 2, -1, -2, 1], 1 if k == 0: maximum = [] arr.sort() ans = arr[-k:]
k
int
lst = [5, 9] solution = sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
lst
list
lst = [5, 9] solution = sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1])
solution
int
arr, k = [111,121,3,4000,5,6], 2 add_elements = sum(elem for elem in arr[:k] if len(str(elem)) <= 2)
add_elements
int
arr, k = [111,121,3,4000,5,6], 2 add_elements = sum(elem for elem in arr[:k] if len(str(elem)) <= 2)
arr
list
arr, k = [111,121,3,4000,5,6], 2 add_elements = sum(elem for elem in arr[:k] if len(str(elem)) <= 2)
k
int
n = 12 if n%2==0: odd_collatz = [] else: odd_collatz = [n] while n > 1: if n % 2 == 0: n = n/2 else: n = n*3 + 1 if n%2 == 1: odd_collatz.append(int(n)) get_odd_collatz = sorted(odd_collatz)
get_odd_collatz
list
n = 12 if n%2==0: odd_collatz = [] else: odd_collatz = [n] while n > 1: if n % 2 == 0: n = n/2 else: n = n*3 + 1 if n%2 == 1: odd_collatz.append(int(n)) get_odd_collatz = sorted(odd_collatz)
n
float
n = 12 if n%2==0: odd_collatz = [] else: odd_collatz = [n] while n > 1: if n % 2 == 0: n = n/2 else: n = n*3 + 1 if n%2 == 1: odd_collatz.append(int(n)) get_odd_collatz = sorted(odd_collatz)
odd_collatz
list
n = 12 if n%2==0: odd_collatz = [] else: odd_collatz = [n] while n > 1: if n % 2 == 0: n = n/2 else: n = n*3 + 1
n
float
n = 12 if n%2==0: odd_collatz = [] else: odd_collatz = [n] while n > 1: if n % 2 == 0: n = n/2 else: n = n*3 + 1
odd_collatz
list
n = 12 if n%2==0:
n
int
date = '06-04-2020' try: date = date.strip() month, day, year = date.split('-') month, day, year = int(month), int(day), int(year) if month < 1 or month > 12: valid_date = False if month in [1,3,5,7,8,10,12] and day < 1 or day > 31: valid_date = False if month in [4,6,9,11] and day < 1 or day > 30: valid_date = False if month == 2 and day < 1 or day > 29: valid_date = False except: valid_date = False valid_date = True
date
str
date = '06-04-2020' try: date = date.strip() month, day, year = date.split('-') month, day, year = int(month), int(day), int(year) if month < 1 or month > 12: valid_date = False if month in [1,3,5,7,8,10,12] and day < 1 or day > 31: valid_date = False if month in [4,6,9,11] and day < 1 or day > 30: valid_date = False if month == 2 and day < 1 or day > 29: valid_date = False except: valid_date = False valid_date = True
day
int
date = '06-04-2020' try: date = date.strip() month, day, year = date.split('-') month, day, year = int(month), int(day), int(year) if month < 1 or month > 12: valid_date = False if month in [1,3,5,7,8,10,12] and day < 1 or day > 31: valid_date = False if month in [4,6,9,11] and day < 1 or day > 30: valid_date = False if month == 2 and day < 1 or day > 29: valid_date = False except: valid_date = False valid_date = True
month
int
date = '06-04-2020' try: date = date.strip() month, day, year = date.split('-') month, day, year = int(month), int(day), int(year) if month < 1 or month > 12: valid_date = False if month in [1,3,5,7,8,10,12] and day < 1 or day > 31: valid_date = False if month in [4,6,9,11] and day < 1 or day > 30: valid_date = False if month == 2 and day < 1 or day > 29: valid_date = False except: valid_date = False valid_date = True
valid_date
bool
date = '06-04-2020' try: date = date.strip() month, day, year = date.split('-') month, day, year = int(month), int(day), int(year) if month < 1 or month > 12: valid_date = False if month in [1,3,5,7,8,10,12] and day < 1 or day > 31: valid_date = False if month in [4,6,9,11] and day < 1 or day > 30: valid_date = False if month == 2 and day < 1 or day > 29: valid_date = False except: valid_date = False valid_date = True
year
int
txt = "Hello world,!" if " " in txt:
txt
str
lst = [] count_digit = dict([(i, 0) for i in lst]) for i in lst: count_digit[i]+=1 if any(count_digit[i] > 2 for i in lst): is_sorted = False if all(lst[i-1] <= lst[i] for i in range(1, len(lst))):
count_digit
dict
lst = [] count_digit = dict([(i, 0) for i in lst]) for i in lst: count_digit[i]+=1 if any(count_digit[i] > 2 for i in lst): is_sorted = False if all(lst[i-1] <= lst[i] for i in range(1, len(lst))):
lst
list
lst = [] count_digit = dict([(i, 0) for i in lst]) for i in lst: count_digit[i]+=1 if any(count_digit[i] > 2 for i in lst): is_sorted = False if all(lst[i-1] <= lst[i] for i in range(1, len(lst))): is_sorted = True else: is_sorted = False
count_digit
dict
lst = [] count_digit = dict([(i, 0) for i in lst]) for i in lst: count_digit[i]+=1 if any(count_digit[i] > 2 for i in lst): is_sorted = False if all(lst[i-1] <= lst[i] for i in range(1, len(lst))): is_sorted = True else: is_sorted = False
is_sorted
bool