Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Anthony BurtPython Development Techdegree Student 644 Points
Less 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]
Chris FreemanTreehouse Moderator 67,515 Points
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
The >= is a value comparison operator where the expression:
a >= b
True value if a is greater or equal to b.
There is no >- operator. (perhaps a typo?)