Susanna Learns Python
Susanna Learns Python
Hey, so, obviously I already know Python.
But it needs to be improved. A lot. I have a lot of background of working in JavaScript, TypeScript, HTML, CSS and React. But I am a Python developer now. And I'm so happy because this is the language of everything I love - AI and renewable energy.
But it needs to be improved. I did a lot to get in here and to get this job, but more Python needs to be learned for me to really perform in it. I have agreed with my boss that I will get practising, and that plan includes:
- Codewars challenges
- Codecademy challenges
- Codecademy courses (intermediate/advanced)
- Someone has recommended Udemy challenges but I am busy for now.
I love me, I love myself, and I love everyone who I work with so there is no reason why things should be done or be handled with anything other than love - and I am so lucky and so amazing to have a loving and great relationship with my colleagues where we can tell each other things - I am so lucky to have such an amazing manager who will tell me what things I need to improve on too - and who will work with me to get there.
So naturally I got cracking
I got started with some codewars this morning, on a Saturday. There are some things that need doing and I want to get out but I wanted to get stuck in a bit first. I started with an easier challenge - I should probably be doing 6 kyu to test myself but for an easier start and to practise more Python I am going for a slightly easier 7 kyu (it goed downwards from 8 to 1).
I went for the most popular question - my answer is a bit simplistic but again I am rushing.
I could't get the tests to pass at first but I made two errors
- I was trying to make things too complicated and do something like for letter in range(len(sentence)) (not even sure if that was working or not) when I could actually do for letter in sentence
- I was actually forgetting to return anything - for some reason this has been throwing me in Python, probably because I have been using so many classes and or functions that don't need to return anything. But the functions in Python work exactly the same as returns in JavaScript - so that is a good thing to be reminded of.
Straight away, I can see that there are much better ways of doing this in Python.
Some of them involve regex - or do they? No, it's not regex. I just can't get used to the in thingy in Python and what it allows you to do. It is so useful and so good!
The list went on and on and on.
There are so many ways to do this better in Python than I did it
And some of them I would've even known in JavaScript if I had stopped and thought. I feel so, so, so embarrassed. But also like I want to improve and practice and learn.
This one uses something like with a "generator" with the one which is something I don't really understand and I might ask my mentor on Monday.
This one probably necessitates for me to go away and understand how the sum() function actually works.
This one is much more familiar to me - again the key thing I kept forgetting is that you can do the 'in' thing to search.
I plan to do a part 2 blog post later today where I go over the things I didn't know but I am rushing out now.
I can see they're calling len() on the output of this, and also that they have given len() multiple params. This is all new to me. I will research further!
This is also new to me as well - they are using sum() (I know what it does but I want to understand it better) and then they are using ".count()" - and then they are using count() on a list of characters. This one needs researching further - I will do that maybe later today!
This is a list comprehension inside of a len() function.
Again, I will research this later today and go over this again, when I get home later, thank you.
I really really want some Harry Potter stationary.
Maybe I will get some later today.
Sorry, that was an aside #ADHD
This is also looking similar to me.
One question I have is - can you do num_vowles ++ like you would in JavaScript? I will find out later today, okay.
I love you all - thank you for reading.
Comments
Post a Comment