Python Forum
Mathematical Operators in String - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Mathematical Operators in String (/thread-24785.html)



Mathematical Operators in String - AgileAVS - Mar-04-2020

Hey this is a very simple question, how do I use mathematical numbers in text such as 1,000.00 and 9,000.00.
For example:
x=float(1,000.00)
y=float(19,000.00)
print(x*y)
Error:
Traceback (most recent call last): File "C:\Users\aabha\OneDrive\Desktop\py4e\rough.py", line 1, in <module> x=float(1,000.00) TypeError: float expected at most 1 arguments, got 2



RE: Mathematical Operators in String - Gribouillis - Mar-04-2020

Starting with python 3.6, one can use underscores in numeric literals. Commas are not supported.