def expand(nums):
finalword = ''
position = 0
wordlength = len(nums)
keypoint = ''
while position <= wordlength:
keypoint = nums[position] * int(nums[position + 1])
finalword = finalword + keypoint
keypoint = 0
position + 2
return finalword
For some reason, this function does not return a value. I am trying to get the integers after a char to multiply said char. I add 2 to position due to a char being on every 2nd index
print(expand("d3o5z2y1")) #should output: dddooooozzy
What am I doing wrong?