Ad

The code should receive an input, and give out an output according to the assert equals tests, as described below.

Examples:

o 'hello' should output 'h tato'
o 'hello world' should output 'llo wollo wohello w tato'
o 'hello world!' should output 'llo worllo worhello wo tato'
o 'potato code test program.' should equal 'tato code test progrtato code test progrpotato code test prog tato'

HINT:

  • It always ends with ' tato'
def PotatoCode(input):
    output = input[2:len(input)-3]*2+str(input[:len(input)-4])+" tato"
    return str(output)

Your goal is to have a function where the input gets you a correct output according to the pattern.

For example:

  • the input 5 should output 576
  • the input 6 should output

Good luck!

SCROLL DOWN FOR HINTS
.
.
.
.
.
.
.
.
.
.
.
.
HINT #1:
-There is 1 multiplication symbol, and one pair of parenthesis (atleast, depending on the way you make the function)

HINT #2:

  • The program can run in 1 line of code.

HINT #3:

  • The input 15 gives an output of 1936
def pattern(n):
    output = n[:]
    return (output*2 + 14)**2