Problem in the code is not solved After changes! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Problem in the code is not solved After changes!

Could you help me find the problem in this code? I tried to organize the intendation but no result. Sample input: dannie:H.lat-nom Sample output : Hydrogenium https://code.sololearn.com/ckOeIy01cH04/?ref=app

12th Apr 2023, 2:34 PM
Ben Hamida Mohamed Amine
Ben Hamida Mohamed Amine - avatar
3 Answers
+ 9
Ben Hamida Mohamed Amine , python has detected a *SyntaxError: invalid non-printable character U+00A0* . this character is a so called *NO-BREAK SPACE*. this character is frequently used in websites to prevent line breaks. it can occur multiple times, so you have to remove them all.
12th Apr 2023, 4:16 PM
Lothar
Lothar - avatar
+ 3
I think the problem is with **re** module, as you trying to match something with "^" which might represent something different (I'm not a fan of regex module). Also, do you have periodic table elements in if statements? If variable == "Au": and so on ... ? Instead, you can put element symbols as keys in dictionary and their atomic mass as values. I have made a similar program few weeks ago. https://code.sololearn.com/c3i1CDAM8Vva/?ref=app
12th Apr 2023, 3:43 PM
Lamron
Lamron - avatar
+ 2
Lamron , Hi sir , i don't think that the problem is in the regex module , and yes , i have periodic table elements , but the code i provided is a basic one , because the complete code is too long (600 line)
12th Apr 2023, 3:53 PM
Ben Hamida Mohamed Amine
Ben Hamida Mohamed Amine - avatar