Tuples and Sets are a lot like Lists which we learned about in our last video. They both store multiple data. However, there are some big differences. Sets cannot have any duplicate values and a set is also unordered (no index). Tuples are like lists that cannot be changed (immutable). These both offer some advantages. We can take advantage of the fact that sets don't allow duplicates to remove duplicates from a list with ease by simply converting a list to a set. Sets also allow us to identify in Venn diagram fashion, the elements in common between sets or the differences, etc using union(), intersection(), difference(), and symmetric_difference() methods.
We do an example where we pull the keywords from the internet movie database for Fellowship of the Ring, Harry Potter (Sorcerer's stone), and Star Wars (A New Hope) and see what they have in common etc. Try it yourself with the .csv file available on my github.
https://github.com/sp8rks/MSE2001pyth...
Tuples make assignments simultaneously so we can use these to easily swap variable values. We can also take advantage of packing and unpacking with tuples.
In questa pagina del sito puoi guardare il video online 7. Tuples and Sets in python della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Taylor Sparks 14 novembre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,857 volte e gli è piaciuto 32 spettatori. Buona visione!