Changes

Jump to: navigation, search

OPS435 Python Lab 4

9 bytes added, 16:22, 14 June 2017
PYTHON REFERENCE
|- style="background-color:white;border:none;"
| style="border: 2px solid black;" valign="top"| :*[https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences Tuples]<br> [https://docs.python.org/3/tutorial/datastructures.html#sets Sets]
| style="border: 2px solid black;" | [https://docs.python.org/3/tutorial/introduction.html#lists Lists]<br>[https://docs.python.org/3/tutorial/datastructures.html#more-on-lists More on Lists]<br>[https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions List Comprehensions]
| style="border: 2px solid black;" valign="top"| [https://docs.python.org/3/tutorial/introduction.html#strings Strings]<br>[https://docs.python.org/3/library/string.html String Comparisons]
:#First, access a set through the index.<source>
s1[0]
</source>This should have created an error, this is not how to access data inside a set because they are '''un-ordered'''. Instead, you should use the method (used in the previous section) to check to see if a value is contained within the set.<br><br>
:#To demonstrate, issue the following:<source>
'Ix' in s1
13,420
edits

Navigation menu