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.
Auf dieser Seite können Sie das Online-Video 7. Tuples and Sets in python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Taylor Sparks 14 November 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,857 Mal angesehen und es wurde von 32 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!