Skip to content

Instantly share code, notes, and snippets.

@Ruslan-Skira
Created January 20, 2023 13:55
Show Gist options
  • Save Ruslan-Skira/44cfdbf31e9ba7bb8c12fd36b44d54c1 to your computer and use it in GitHub Desktop.
Save Ruslan-Skira/44cfdbf31e9ba7bb8c12fd36b44d54c1 to your computer and use it in GitHub Desktop.
Logic tasks from job interview
# parameterize decorator
def args_info():pass
@args_info(all_values=False)
def power(n:int, pwr: int) -> int:
"""Put in the power"""
return n**pwr
# >>> power(2, 4)
# ~ Called with 2 args ~
# 16
# >>> power(n=2, pwr=4)
# ~ Called with 2 args ~
# 16
@args_info(all_values=True)
def power(n: int, pwr: int) -> int:
"""Put in the power"""
return n ** pwr
# >>> power(2, 4)
# ~ Called with: 2 4 ~
# 16
# >>> power(n=2, pwr=4)
# ~ Called with: 2 4 ~
# 16
"""
Write function
CONST = "EFFECT
function('EEFECT') => 0
function('EfFECT') => 1
function('EFFECT EECT FF ') => 2
witch return how much CONST word you could create from letters
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment