Friday 20 December 2019

Python - Day Thirty One (December)

WHAT I DID TODAY:


Today I didn't finish just the files input/output unit but I finished the whole entire Python 2 course. Even though this was the very last chapter, it wasn't a review, but it was actually a completely new unit where I learned tons of new syntax and codes. 


100% COMPLETE
LESSONS I DID TODAY


     FINAL EXERCISE


The final review of course consisted of all the new codes I learned, it may look confusing but all this does is opens a new 'text file' kind of and reads it. If the text.txt tab has written 'My Data' it will return as true as stated in the code.


WHAT I LEARNED:



This unit was mainly about how to read/write information from a different file on your computer. Code Academy mentions that all we have been doing is typing codes, and the results come out in the output console. I learned that this process is called file I/O which stands for input/output. And Python already has built-in functions for this.


  • The first thing I learned was the open() function. I'm sure the name sounds pretty self-explanatory but basically, this code tells Python to open output.txt in"w" mode which stands for "write." Doing this opens the file in write mode.
open() code


  • The second thing I learned was the reading file code. This code just reads the output.txt.
.read() code

  • The third thing I learned was a bit confusing, but I'm pretty sure it opens and closes files for you, as Python usually does all the work. File objects contain a special pair of built-in methods.
with and as syntax


WHAT I WILL BE DOING NEXT TIME:

So now that I have finished the entire course, I was thinking of doing a final game such as creating a small program or even game to finish off.

I will be taking steps and start thinking about what to do and then start on it next time.



No comments:

Post a Comment

Adobe Photoshop - Day 10 (June Final Post)

WHAT I DID TODAY / WHAT I LEARNED: For my final project, I thought for a while about what I could do. Then I remembered a while back I saw ...