Challenge 1: Append Hearts

In this challenge you have to create a vector whose every element contains the string "<3" replicated the number of times mentioned in the input vector.

Problem Statement

Implement the function hearts() that takes a vector as input and returns a vector whose each element is a string “<3” replicated the number of times mentioned in the corresponding input vector.

Input

A testVariable containing a vector of numbers.

Output

A vector of strings.

Sample Input

testVariable <- c(5, 2)

Sample Output

"<3<3<3<3<3", "<3<3"

Test Yourself

Write your code in the given area. If you get stuck, you can look at the solution.

Press + to interact
hearts <- function(testVariable)
{
# Write your code here
}

In the next lesson, we have a solution review for this challenge.