0
I have an issue. This python program runs in my computer but shows error in solo learn code ground. Help me sort out this
#Python program find numerals in a string and change it with alphabets sample = input() def add_string(mystring, position, num_name): Â Â my_string = my_string[:position] + num_name + my_string[position:] Â Â return my_string nums = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] names = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] for i in range(len(sample)): Â Â for j in range(len(nums)): Â Â Â Â if sample[i] == nums[j]: Â Â Â Â Â Â sample = add_string(sample, i, names[j]) print(sample)
3 Answers
0
you have copied some non ascii characters in your code.
I cleared them.
- the function parameter mystring is not used in the function definition
should be my_string
* your code still need some tuning. is this a code coach?
https://code.sololearn.com/cqdJ24Wi3svk/?ref=app
0
the my_string parameter in parenthesis is missing an underscore
0
Thanks