[Tutor] err in integration

dn PyTutor at DancesWithMice.info
Sun May 2 04:55:31 EDT 2021


On 02/05/2021 20.27, Msd De wrote:
>
> I tried
> print(f"The numerical result is {J1} (+-{err})")
> this gives syntax error.
>
> Thanks in advance


The words you don't want to hear: "it works for me":

Python 3.9.2 (default, Feb 20 2021, 00:00:00)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> J1 = 0.203920669888
>>> err = None
>>> print(f"The numerical result is {J1} (+-{err})")
The numerical result is 0.203920669888 (+-None)


Please see earlier note about Python version (3.6+) - that's when
f-strings were introduced.

Whilst I appreciated your personal reply, please post to the list -
others will assist, and likely faster (and yet others may have a similar
question or benefit from the learning-opportunity.

Please don't top-post. A conversation is normally in the sequence:
question, then answer...
-- 
Regards,
=dn


More information about the Tutor mailing list