Both of those cases would be discrimination. Please go find a dictionary.
The real question is whether those forms of discrimination are acceptable. I would argue yes for both of those cases. I believe people should be able to choose their environments so that they are comfortable in them.
Now suppose we are in London, and there are women who want to learn Python but due to religion or upbringing would not be comfortable in mixed company.
Neither of these cases is "discrimination" against anyone. It's not any kind of aggression at all.
It's also not discrimination when there are women who feel intimidated by the main groups and want a group that is more explicitly friendly to women.