1

I wrote the following code in Python 3.

x= int(input ("Enter the first number: "))
y= int(input ("Enter the second number: "))
z= int(input ("Enter the second number: "))
tot = x+y+z
avg = tot/3
print ("average = ",avg)

Result when I enter 2,7,1 as the first, second and third number, it prints:

average =  3.3333333333333335

When I enter 20, 70, 10 it prints:

average =  33.333333333333336

When I try with 200, 700, 100 it renders:

average =  333.3333333333333

Please explain me the exact reason to get different values as the average in the above 3 cases.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

0 Answers0