Python Programming: Lesson 70 - Pass by Value and More Techniques for Sets and Dictionaries

Published: 01 January 2022
on channel: youmils03
70
0

PLEASE SUBSCRIBE!!!

In the previous lesson (   • Python Programming: Lesson 69 - Chara...  ), we talked about ASCII character encoding. This happens through two methods:
chr(x) accepts an ASCII character encoding and returns the character with that code
ord(x) accepts a character and returns an integer representing the ASCII character encoding [inverse of chr(x)]

We also review zip(x,y), which is a generator that yields tuples where corresponding elements from x and y line up as far as index positions go. x and y do not have to be the same type of iterable; you could have a list for x and a tuple for y, for example.

In this lesson, we bring up 2 new topics. Python passes information by copying the value of a variable into a method. It does not take the reference of the actual variable, leading to unexpected behavior. There are 3 solutions to this:
1. use an instance variable for an object belonging to a class. Increment it
2. use a return method rather than a void method to return a new value which is an incremented version of the original variable
3. use a list with one element in it, incrementing it

0:28 Overview of JSON, Frozen Dictionaries, The iskeyword function, the type function, hexademical numbers, ASCII character encoding (through ord(x) and chr(x)), and the zip generator
3:41 Review of Hexadecimal Numbers in Python
5:35 Review of ASCII Character Encoding
6:42 Review of The zip(x,y) Generator
9:03 NEW: Pass-by-Value
15:31 NEW: Concise Techniques for Sets
17:42 NEW: Immutable Keys for Dictionaries

An equivalent lesson regarding pass-by-value in Java is available here:    • Java Programming: Lesson 71 - Pass by...  

In the next lesson (   • Python Programming: Lesson 71 - Const...  ), we'll see more examples of pass-by-value, as well as another opportunity to see shorthand notation for sets and immutable keys in dictionaries. We might also have a chance to go back and review hex(x), chr(x), and ord(x).

Thanks for watching, and PLEASE SUBSCRIBE!!!


Watch video Python Programming: Lesson 70 - Pass by Value and More Techniques for Sets and Dictionaries online without registration, duration hours minute second in high quality. This video was added by user youmils03 01 January 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 70 once and liked it 0 people.