I am solving a problem in hackerrank , and i cannot print a output with two decimal places.
I have tried round(number,2) and -
avg=(toavg[0]+toavg[1]+toavg[2])/3
print(float("{0:.2f}".format((toavg[0]+toavg[1]+toavg[2])/3)))
I am using python 3.
if __name__ == '__main__':
n = int(input())
student_marks = {}
for _ in range(n):
name, *line = input().split()
scores = list(map(float, line))
student_marks[name] = scores
query_name = input()
toavg=student_marks[query_name]
avg=(toavg[0]+toavg[1]+toavg[2])/3
print(float("{0:.2f}".format((toavg[0]+toavg[1]+toavg[2])/3)))
I expected 56.00 or 36.50 but i got 56.0 or 36.5.