Given a string, return a string where for every char in the original, there are two chars.
double_char('The')
→ 'TThhee'
double_char('AAbb')
→ 'AAAAbbbb'
double_char('Hi-There')
→ 'HHii--TThheerree'
Solution:
def double_char(str):
double_char = ""
for i in range(len(str)):
double_char += str[i]*2
return double_char
Hello, I'm new here, and it's my first time discovering this website and adding a question, so I'm sorry if it's a bit unclear. Can someone please explain this one in detail ? Like why it has empty quotation marks?