Things I learned
__init__(self) initialises or boots up the objects in a class (self is not required but most people use it)
We have to remember that global variables, member variables, and instance variables exist and same goes for functions too
A function within a class is a method
A class method to override is the __repre__()
f = open(“output.txt”, “w”) This tells the computer that the file object ‘f’ opens output.txt in w mode which is write, r+ can be used for reading and writing
file.close() before writing anything
.write() takes in strings and writes it down
+ “\n”makes sure if a for function happens, all the values appear in a new line
.readline() reads the lines subsequently with each readline command there is
You can use __enter__() and __exit__() to open and close files the way we do this is with with ‘open() as ‘anything”
Something I realise is that it gets harder and harder to explain things in my blog posts and using examples are starting to help much more. As the lessons are becoming more how to use the functions and variables. The difficulty of these lessons are still very difficult but aren’t getting more difficult thankfully.
This challenge was pretty simple after I knew what I had to do. The code above is the same thing as the caesar cipher, a old ciphering method used where the letters are shifted three to the right.
The challenge was a bit too much for me currently. I’ve even tried looking at other people’s posts for some clues on where I should start. But I hope to do this for my final project.