0

I'm learning python from beginning and I don't understand the part where it says {2:.2f}. I know it is related to string format, but no more.

a = int(input('introduce a number: '))
b = int(input('introduce a number: '))

print('the result of {0} divided by {1} is {2:.2f}, and the result of {1} divided by {0} es {3}'.format(a, b, a/b, b/a))

Thanks!

2
  • This indicates a float rounded by two digits. See more information here Commented Oct 27, 2021 at 14:21
  • See also stackoverflow.com/questions/8885663/…. Note that the "f" you are asking about is a different "f" than the "f" in "f-string". Commented Oct 27, 2021 at 14:22

1 Answer 1

0

it stands for floating point number, which means the amount of digits after the point

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.