I have an issue. This python program runs in my computer but shows error in solo learn code ground. Help me sort out this | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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)

4th May 2020, 3:22 AM
Maheswaran Venkatachalam
Maheswaran Venkatachalam - avatar
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
4th May 2020, 4:12 AM
Bahhaⵣ
Bahhaⵣ - avatar
0
the my_string parameter in parenthesis is missing an underscore
4th May 2020, 4:13 AM
Slick
Slick - avatar
0
Thanks
4th May 2020, 4:25 AM
Maheswaran Venkatachalam
Maheswaran Venkatachalam - avatar