• Home
  • Blog
  • Programming Codes & Function Creation Problems

Programming Codes & Function Creation Problems

0 comments

Create a function called repeat_name that receives a name as a parameter, the function must verify that the name contains 4 or more characters, if so, it will convert the name all in uppercase and the function will return that name in uppercase, repeating the same number of times as characters have. In case the name doesn’t have 4 or more characters, the function will return the name in reverse and with the first letter capitalized.

Example 1:

repeat_name(“Alex”);
The output should be: ALEX ALEX ALEX

Since “Alex” has 4 characters, this function should return the name in CAPS 4 times.

Example 12:

repeat_name(“Amy”);
The output should be “Yma”

This is because “Amy” has less than 4 chracters, so the function should return the name in reverse witht he first letter in CAPS 

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}