Deandrea Rancher
Deandrea Rancher

Reputation: 9

Use a for loop/ accumulator pattern

How to write a function emphasize() that takes as an input a string s and print it with spaces inserted between adjacent letters. This is what I tried

def emphasize (s):
  for aWord in s:
    print(s.replace [1:-1])

Upvotes: 0

Views: 257

Answers (1)

Tony Vincent
Tony Vincent

Reputation: 14272

You can use .join to

def emphasize(s):
  print(" ".join(s))

Upvotes: 1

Related Questions