Repeat-2

A MathWikiből
(Változatok közti eltérés)
(Új oldal, tartalma: „==Problem 1 (2.5 point):== Write a search() function, which first parameter is an x and after that it can have arbitrary many named parameters. (search(x, **kwargs)) Th…”)
 
6. sor: 6. sor:
 
  search(2, a=1, b=3) -> False
 
  search(2, a=1, b=3) -> False
 
  search(2, a=1, b=3, c=2) -> True
 
  search(2, a=1, b=3, c=2) -> True
 +
 +
==Problem 2 (3.5 point):==
 +
Write a variadic increasing() function, which inputs are arbitrary many positive natural numbers, and it
 +
returns True if the sequence of the numbers contains an increasing subsequence of length 3.
 +
 +
Examples:
 +
increasing(1, 2, 1, 2, 4) -> True
 +
increasing(1, 2, 1, 2, 1) -> False

A lap 2021. április 30., 07:44-kori változata

Problem 1 (2.5 point):

Write a search() function, which first parameter is an x and after that it can have arbitrary many named parameters. (search(x, **kwargs)) The function should return True, if there exist a key in kwargs, for which the corresponding value is x. Otherwise it should return False.

Examples:

search(2, a=1, b=3) -> False
search(2, a=1, b=3, c=2) -> True

Problem 2 (3.5 point):

Write a variadic increasing() function, which inputs are arbitrary many positive natural numbers, and it returns True if the sequence of the numbers contains an increasing subsequence of length 3.

Examples:

increasing(1, 2, 1, 2, 4) -> True
increasing(1, 2, 1, 2, 1) -> False
Személyes eszközök