Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Anthony Burt](https://secure.gravatar.com/avatar/ab482a8a99a49a9dc0e74b50d7c22393?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Anthony Burt
Python Development Techdegree Student 644 PointsLess than or equal
Hello, Why in the following code would you right -= rather than >= I am trying to understand the difference. If I put >- then the remaining tickets counter does not lower.
#If they want to proceed
if should_proceed.lower() =="y":
#Print out to the screen "SOLD!" to confirm purchase
print("SOLD!")
#and then reduce the tickets remaining by the number of tickets purchased.
tickets_remaining -= num_tickets
[MOD: added ```python formatting -cf]
1 Answer
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsHey Anthony Burt, there certainly are a lot of operators in python! The += is an in place operator where:
a += b
# same as
a = a + b
that is, add b to a and put the result back in a. So in the code above, num_tickets
is subtracted from tickets_remaining
and the result is placed back into tickets_remaining
.
The >= is a value comparison operator where the expression:
a >= b
returns a True
value if a is greater or equal to b.
There is no >- operator. (perhaps a typo?)
Anthony Burt
Python Development Techdegree Student 644 PointsAnthony Burt
Python Development Techdegree Student 644 PointsHello Chris. Thank you so much for the detailed answer! That makes a lot more sense. Yes, this >- was a typo. I meant type >= I see now why that was not working.