Python & ML tasks
416 subscribers
2 photos
3 links
Python, functions, classes, iterators, generators, numpy, pandas, scikit-learn, TensorFlow
for advertising: @dina_ladnyuk

For advertising and donations in USD:
SWIFTBIC BUKBGB22
IBAN GB40 BUKB 2047 3453 2396 99
Mrs Dina Ladnyuk
Download Telegram
What will this code do?
def f(*args):
res = ""
l = len("".join(args[:-1]))
for i, s in enumerate("".join(args)):
if i > l:
res += s
return res
s1, s2, s3= "one", "two", "three"
print(f(s1, s2, s3))
What will this code do?
def mineven(*args):
res = args[0]
for arg in args[1: ]:
if arg < res and arg % 2 == 0:
res = arg
return res
data = [3, 2, 1, 0, -1, -2, -3]
mineven(*data)
What will this code do?
def f(*args):
result = []
for seq in args:
for x in seq:
if not x in result:
result.append(x)
return ''.join(result)
s1, s2, s3= "message", "massage", "mask"
print(f(s1, s2, s3))
What will this code do?
def f(*args):
result = []
for x in args[0]:
for w in args[1:]:
if x in w:
break
else:
result.append(x)
return "".join(result)

s1, s2, s3= "hello", "hi", "good morning"
print(f(s1, s2, s3))
What will this code do?
sorted([1, 2, 3, 4, 5], key=lambda x: -x, reverse=True)
What will this code do?
def f(arr):
if not arr:
return 0
return arr[0] + f(arr[1:])
f([1, 2, 3, 4, 5])
Choose the correct answer
Anonymous Quiz
20%
0
7%
1
13%
3
7%
5
53%
15
0%
IndexError
What is the result of calculating this function called??
def f(n):
return n * f(n-1) if n > 1 else 1
What will this code do?
def f(arr):
return 0 if not arr else arr[0] + f(arr[1:])
print(f([]))
What will this code do?
def f(arr):
return arr[0] if len(arr) == 1 else arr[0] + f(arr[1:])
print(f([]))
What will this code do?
def f(arr):
first, *rest = arr
return first if not rest else first + f(rest)
print(f([]))
What will this code do?
def f(n):
def g(x):
return x**n
return g
g = f(2)
print(g(7))