Tuesday 24 September 2019

Python - Day Three (September)

WHAT I DID TODAY:


Today I started working on the Strings & Console Output unit in the Python 2 course. I only got through half of it, so 8/16 lessons but I actually learned a lot more than I did on my other days. 


TYPE OF LESSONS I WENT THROUGH

Despite the few lessons I went through, I also did additional research so I can understand how the strings work more easily instead of just speeding through everything.



WHAT I LEARNED:


Even though it looks like I didn't do much I learned a lot of new things.

  • The first thing I learned was about another error type of problem. When writing code in python doubles quotes " or single ' is sometimes used. But sometimes when using single quotes, it's possible that the use of an apostrophe is needed for words such as (isn't.) When this happens, the code will obviously show up as error since it's basically breaking the line of code. To fix this, I learned that you just need to put a \ in between the letter before the apostrophe and the apostrophe itself. Below shows a clearer visual image of what I said.
FIXED VERSION
BROKEN/ERROR VERSION


  • The second thing I learned was using a single command to transform a whole line of text into capital/lower case letters. This command may not be super useful but who knows. And it is something new I learned so I decided to add this in. The command to do so is .upper() or .lower() after the variable in print. Examples are shown below.
.lower()
.upper()



  • The third thing I learned was that there is a command that counts the number of characters you have. It is a very simple and self-explanatory command. 


EXAMPLE

(So you just assign a variable a text, like normal, then use 
print len(variable)

WHAT I WILL BE DOING TOMORROW / NEXT TIME:


I will be continuing on with the Strings unit on Code Academy. 



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 ...