On 01/12/15 05:04, jo stone via Tutor wrote: > Hello, > I am trying to teach myself Python, and got hung up on the definition of > Assignment signs...
This is usually only a big problem for those who are strong in mathematics where = means that two things are equal in value and does not mean that either of them is changing value., In programming (in Python and many other languages) it means that the left hand side takes on the value of the right hand side. (For expressing equality we use a double == instead) > The explination I have is: > "A good way to understand the statement userAge = 0 is to think of it as > userAge <- 0." > > I read this as "userAge is less than minus 0" which make absolutely NO > sense to me... This looks like a classic case of somebody confusing things by trying to explain it :-) The <- is intended to be seen as an arrow pointing from the 0 to the userAge name. It indicates that userAge takes on the value 0. Another way of thinking about it is to read assignments in code as the word "becomes" so you read userAge = 0 as userAge becomes zero. For a different (and slightly more technically correct) explanation of assignment in Python try reading the section on variables in my tutor(see below) in the "Raw Materials" topic. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
