The teacher made a simple request, and the student retorted with a snide remark.New Frontiersman said:By the way I do agree, that teacher sounds like quite the douche.
While his reaction to that may have not been the most professional response, he didn't show any sort of disrespect to the student until said student showed it to him. Sure, most of the class were being idiots, but sometimes a person in an authoritative position has to enforce something trivial to make a point.
However, the teacher in question may or may not be a total asshat. Even still, just like in the real world, there are rules against a great many pointless things, which will all, at one time or another, be enforced. Sadly, there is no rule against being an idiot, which is something the OP showcased the rest of his classmates as being guilty of.
OT: Pull up your socks. You were aware of the rule, and you broke it. Punishment is only fitting.
That being said, pick your battles a little better in the future. Arguing with a teacher over a nonsensical rule is not going to get it changed, just cause you grief in the form of punishment for breaking a rule, and the ire of the teacher who has to enforce it, because they'll see you as a troublemaker (their own disposition is irrelevant).
His reaction wasn't the greatest, but it's certainly a reaction that most of us would entertain if someone was snippy in response to a valid request. You may have not intended to be snide, but that's definitely how your response comes across.