a=int(input())
b=float(input())
c=a/b
print(format."c{:.2f})
I am not getting.
a=int(input())
b=float(input())
c=a/b
print(format."c{:.2f})
I am not getting.
This should do the trick neatly.
a=int(input())
b=float(input())
c=a/b
print(round(c,2))
This is a pretty old issue with floating point numbers, the round
builtin function doesn't perform as expected, hence you can use these format specifiers corrected from the one in your code.
a=int(input())
b=float(input())
c=a/b
print(float(f"{c:.2f}"))
Here, you are specifying the float format for the variable c
and inside the parentheses we use f
to specify its formatted and inside curly braces we give the variable c
and restricting it to .2f
i.e 2 digits after the decimal.