On Mon, Mar 2, 2015 at 10:22 PM, <chelse...@yahoo.com.dmarc.invalid> wrote: > > don't understand why these execute different things⦠> > > > > total=total+10 >>>> total=total+25 >>>> total=total+25 >>>> average=total/3 >>>> total > 110 >>>> average > 36.666666666666664
In your first case, what's the value of 'total' *before* all the things you've typed in? Can you say more why you expected to see the same result here as in the next program? They do look textually different, so I'd expect them to likely have a different meaning, so I'm confused as to what your expectations are. Say more about why you expected them to be the same, and maybe we can understand better. > total=0 >>>> total=total+10 >>>> total=total+25 >>>> total=total+25 >>>> average=total/3 >>>> average > 20.0 Your second case makes sense. 10 + 25 + 25 is 60, and if we divide 60 by 3, the we'd expect the average to be twenty. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor