The importance of checking for existing methods, and Python's bitwise operators. Today I Learned: Friday 17 June 2022

  • The .replace() python method I mentioned yesterday worked. Before, i used it, I put so much time into creating some complex code with the method that I knew about. I've learned now to check the code documentation to see if there already might be a method to help with them problem.

    • Big thanks to this guy for showing me the .replace() method.
  • You cannot iterate through an int in a for loop.

    • I tried to use:

      • for i in len(word)
    • This doesn't work. I think it is only for strings and lists.

  • When using a loop to multiply multiple ints, don't initiate the variable with zero.

    • 0 * 4 is still 0
  • I learned about the 'in' and 'not in' conditional statements to check if an element is in a list.

  • functions can be called from within another function.

  • A tuple is an element from a dictionary. It consists of the key and the value

    • eg [('taken', true), ('age', 33)]

    • They around surrounded by brackets: ()

  • There are 'anonymous' functions in Python, as in functions that don't need to be named.

    • lambda is an example of one such function.

    • It works alongside another function called filter.

    • I don't fully understand its purpose yet.

  • Now I'm learning about Python bitwise operators, which are used to modify bits.

    • They're pretty confusing. Theres a thing called a bit mask thats used to check if a bit is on or off.