Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 4

7 bytes added, 08:41, 9 September 2017
LAB REVIEW
= LAB REVIEW =
# What is the purpose of a '''tuple'''? How does a tuple differ from a list?
# How do you define elements within a tuple?
# Write Python code to confirm if the string ''''OPS435'''' exists within the tuple called '''courses'''.
# What is the purpose of a '''set'''? How do sets differ from lists or tuples?
# How do you define elements within a set?
# Assuming you have defined two sets called '''set1''' and '''set2'''. Write Python code to:<ol value="a"><li>Return a set containing all values of both sets</li><li>Returns a set containing all values in set1 that are not found in set2</li><li>Return a set containing all values that both sets DO NOT share</li></ol>
# What is the purpose for the range(), len(), append(), and map() functions for a dictionary?
# List and briefly explain the following functions (methods) that can be used with strings:<br>'''lower()''' , '''upper()''' , '''swapcase()''' , '''title()''' , '''captilize()''' , '''split()'''
# Assume you issued the following command in your ipython3 shell:<br>'''course_name = 'Programming with Python''''<br><br>What will be the output for each of the following Python commands?<ol value="a"><li>'''course_name[12:]'''</li></li>'''course_name[10:]'''</li><li>'''course_name[-1]</li></ol>