#๐ Syntax Error output in chem calculation app
46 messages ยท Page 1 of 1 (latest)
@coral jackal
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
It's a simple concept, but the code itself is pretty complex (to me, at least, since i dont understand some of it)
Show the error message you get
my objective is for it to handle these types of inputs
Fe, FeCl, FeCl + H2O, H2O + H2O + Cl + Fe + etc....
H2O - H2O, FeCl - O2, etc.
simple addition subtraction and formulae
sure
ill show each input
As you can see
it doesnt handle addition with whitespace
for H2O + Cl
AND for some reason
i think it interprets Cl+H2O as (Cl+H2) and then O
i have a feeling i positioned the validity check of the syntax in a very horrible place
organic compounds like this work just fine
but literally its such a simple issue that i cant get my head around
i just need the code to interpret
<whatever the hell> + <whatever the hell> as it is
just split them from the + symbol and add their masses
but it aint working
also i didnt add subtraction but im guessing if i can fix addition thatll be a simple copy paste
how did you come up with the regex for valid expressions?
lets say i didnt rlly come up with it
and i mightve used some assistance
(i dont remember any of my python knowledge from 2 years ago, and i cant bother studying again from the basics)
oh yeah also inputs like this work for some reason
H2O,Cl,H2O,F,Ag,Au etc
but i dont want it to be a comma
and i also dont want it to be a + with no whitespace, e.g. C+C
and i have a feeling a big part of the code is redundant and should be deleted to save space
no idea
ยฏ_(ใ)_/ยฏ
was i not able to explain well
alr man .-.
idk how to help you with code you don't understand
i guess my advice would be to understand it first
you can use regex101.com to play arounod with your regex to see what it's doing
nah dont worry ill try to understand
i just want to publish this project and then work on more basic stuff
alright man
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.