a non-void function must return a value in all possible paths code example

Example 1: Use multiple conditional operators in the checkSign function to check if a number is positive, negative or zero. The function should return "positive", "negative" or "zero".

function checkSign(num) {
  return (num > 0) ? 'positive' : (num < 0) ? 'negative' : 'zero';
}

Example 2: Create a function generateString(char, val) that returns a string with val number of char characters concatenated together. For example generateString('a', 7) will return aaaaaaa.

Create a function generateString(char, val) that returns a string with val number of char characters concatenated together. For example generateString('a', 7) will return aaaaaaa.
def generateString(char, val):
  output = ""
  for i in range(0, val):
    output = output + char
  return(output)
print(generateString(character, count))