Menu
Coddy logo textTech

Encode

Lesson 10 of 12 in Coddy's Python Interview Series course.

challenge icon

Challenge

Easy

Write a function encode that gets,

  • a1 - string

It should return a string where all the characters are hidden with an asterisk except the last four

 

For example, if the function gets sent "4444444444444444", then it should return "4444"


Example:

Input -  4444444444444444

Expected Output -  ************4444

Try it yourself

def encode(a1):
    # Write code here

All lessons in Python Interview Series