Learning Python, Day 3 — "The Number Doctor Python Operators"
Before I start, I have to thank Mark Norman Francis and Tef for justifying my side-eye of "You must use camel case when writing Python variables", because first Mark Norman was like "HELL NO" and then Tef pointed me to PEP 8 and heeeeeey I love me some style guides I dig it.
(I'm not going to say I'll actually use it when I'm learning, but it's good to know it exists. And if I ever actually write anything that can be used by other people, you better believe I'm sticking to this. To save all of us pain.)
Today is a section that has a title that does not make sense. Hopefully this is not an omen.
05 — The Number Doctor Python Operators
The first section, focusing on Arithmetic Operators, was pretty straightforward. I do math. Woo.
I skipped most of the actual examples because, like, I get it. variable + variable or variable - integer or variable * float blah blah blah.
(I did write a little price * VAT test piece. And this is definitely going to help when I inevitably write something that reviews last month's performance over this month's performance. I used to spend a lot of time on working out that math.)
There were also lot of operators that I'm just not 100% sure I'm going to ever use. I had never heard of modulo before, and, like, it was just remainders when I was kid. The use of the % is going to throw me occasionally though, because in my mind, that's percentages, which are decimals. And then there was floor division, which is making me twitch, because all those missing remainders. Am I gonna have to do floor division and then modulo just to get the right amount of something?
(As a complete aside, the lecturer would stop having to constantly delete code if they didn't use the camel case. How often am I seeing this person type myAGe and then deleting it to be myAge? SO MANY TIMES)
Exponents could be useful, but, man, I am going to have a hard time remembering ** instead of ^. Comparative operators are going to be incredibly useful in everything I do, but due to my life in ancient fandoms, I'm so used to ! being "adjective of character" instead of != being "not equal to". Like, come on, I spend all my time thinking Genderswap!Krycek and now you're telling me Genderswap!=Krycek?
Then it got into BEDMAS, which...ay...like, I know this, but at the same time, thinking about it makes my head hurt and then I keep on thinking I'm getting it wrong unless it's all bracketed, because that's how I have to think.
Like, 1 * 2 + 3? Where are my brackets oh no give me my brackets (1 * 2) + 3 makes so much more sense.
Just in case you are also an old and do not remember, BEDMAS is:
- Brackets
- Exponents
- Division/Multiplication
- Addition/Subtraction
This is still gonna mess me up. I know it. I mean, I doubt I'm going to be putting in giant piles of maths without brackets, so it's not going to kill me too much, but I am still here, going "No no no no no no why did you write this like this nooooo"
(It also doesn't help that, like, I'd have to check everything over and over. You give me 4 * 2 ** 3 and I'll have to check every step in another calculator just to make sure.)
Day 3 — Results
- I have been vindicated in my dislike of camel case.
- Addition is
+, subtraction is-, multiplication is*, division is/and that is very straight forward. - But exponents are
**instead of^ - Modulo gives you the remainder when you divide something and is
%. Floor division gives you the division without the remainders or decimals and is//. Both are annoying. <,>,<=,=>, and==all exist like they should.!=is "not equals", not "adjective!character"- BEDMAS still makes my brain ache. I'll just remember to use brackets all the dang time.
I'm sure teaching me this has a point, but I am worn out.
I was going to do "The String Doctor Operate on Strings", but after BEDMAS, I think I'm done. I need to be stupid and play Sims 4 for the rest of the day, because...yeesh.
Today's Sticker

A cry-sopod that I got from goodlouse's booth at EM-con last year. And is definitely me not right now. Nope.