Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Assignment operator
#6
(Aug-10-2019, 08:05 PM)DavidTheGrockle Wrote: "Assignment Operator x += 3 is the same as x = x + 3" Why would I bother with the assignment operator ?

x += 3 is just shorthand for x = x + 3. It's a common operation, so they made it easier. You can use it or not as you wish.

(Aug-10-2019, 08:05 PM)DavidTheGrockle Wrote: I still cannot figure out the underlying point.

The underlying point is that there are two different things going on. One is assigning a value to a variable, and the other is comparing two values to see if they are the same. Python, like many languages, uses two different symbols to represent this.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Assignment operator - by DavidTheGrockle - Aug-08-2019, 08:47 PM
RE: Assignment operator - by jefsummers - Aug-08-2019, 08:57 PM
RE: Assignment operator - by ichabod801 - Aug-08-2019, 09:00 PM
RE: Assignment operator - by DeaD_EyE - Aug-09-2019, 01:00 AM
RE: Assignment operator - by DavidTheGrockle - Aug-10-2019, 08:05 PM
RE: Assignment operator - by perfringo - Aug-10-2019, 10:48 PM
RE: Assignment operator - by ichabod801 - Aug-10-2019, 08:13 PM
RE: Assignment operator - by ThomasL - Aug-11-2019, 07:16 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  assignment: not an operator nor expression, but x=y=z=3 works fine? jefdaels 1 2,249 Jan-29-2019, 02:19 PM
Last Post: perfringo
  How many variables/values are limited to single assignment operator? Prabakaran141 1 2,084 Sep-06-2018, 03:32 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020