Daniel
asked

Expert
Udayan Shakya answered
Hello, Daniel. You can't use commas for float numbers in Python (you must use dot). This is because Python recognizes the dot as the standard way to indicate the fractional part of a number.
For example:
print(3.14) # This is a float
print(2.5) # This is also a floatUsing a comma instead of a dot can lead to errors or unexpected behaviors. For instance:
# This will print 3 and 14 as separate numbers
print(3,14)In this case, Python treats 3 and 14 as two separate arguments, so it would output them as 3 14 (two numbers), instead of recognizing them as a single float number.
Hope this helps! Let me know if you have more questions!
Python
This question was asked as part of the Learn Python Basics course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer