I am having trouble solving the following problem:
Ask number input from user and display it as 20.000,00 In case of invalid input from the user, the program must proper message and then repeats the question again. Salary: valid floating point number between (and including) 20.000,00 and 80.000,00.
So is there a way to display decimal separators with a comma? It seems that just about half the world uses dots and the other half uses commas. How do I tackle this problem without using the import function? If there is no better way then use import function then please show me how it's done in this case.
The following code is what I have tried to solve it:
while True:
annual_salary = float(input("Annual Salary:"))
print("{:,}".format(annual_salary))
break
while True:
annual_salary = float(input("Annual Salary:"))
print("{:.2f}".format(annual_salary))
break
Thank you in advance!