Could you help me find the problem in this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could you help me find the problem in this code?

Could You help me to find the problem in this code. Sample input: dannie:H.lat-nom Sample output : Hydrogenium https://code.sololearn.com/ckOeIy01cH04/?ref=app

11th Apr 2023, 9:01 PM
Ben Hamida Mohamed Amine
Ben Hamida Mohamed Amine - avatar
7 Answers
+ 7
The problem in the code is the presence of non-breaking spaces (Unicode character 160) before some of the lines. These characters can cause issues with the Python interpreter because they are not recognized as spaces. To fix this issue, you need to remove these non-breaking spaces and replace them with regular spaces. Fix the indentation of the code. In Python, indentation is important and must be consistent to avoid syntax errors. The code had inconsistent indentation which caused the error message. Also make some minor formatting changes to improve the readability of the code.
12th Apr 2023, 8:57 AM
JAY
JAY - avatar
+ 5
I think your problem with line 15 and then it occurs further down is due to poor indentation. Either use 2x spaces or a tab or 4x spaces per indentation. It could be due to a copy and paste. Fix all those indentations, update the code and write what happens.
11th Apr 2023, 9:15 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
Yes as said before the yellow squares and improper indentation is causing the problem.
12th Apr 2023, 10:45 AM
Paul-Henry Paltmann
Paul-Henry Paltmann - avatar
+ 1
Ben Hamida Mohamed Amine I tried running your code and it runs perfectly on the provided sample input.
13th Apr 2023, 1:28 PM
Евгений
Евгений - avatar
0
I changed the code but the problem still , Can you give me an example? May be i misunderstood you.
12th Apr 2023, 2:20 PM
Ben Hamida Mohamed Amine
Ben Hamida Mohamed Amine - avatar
0
Ben Hamida Mohamed Amine So do you have a problem with your code or not?
16th Apr 2023, 6:14 PM
Евгений
Евгений - avatar
0
No problem , thanks very much 👌
16th Apr 2023, 7:28 PM
Ben Hamida Mohamed Amine
Ben Hamida Mohamed Amine - avatar