Python Forum

Full Version: Mathematical Operators in String
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Starting with python 3.6, one can use underscores in numeric literals. Commas are not supported.