Changes

Jump to: navigation, search

OPS435 Python Lab 4

1,476 bytes added, 07:29, 9 September 2017
LAB REVIEW
= LAB REVIEW =
# xWhat is the purpose of a tuple? How does a tuple differ from a list?# xHow do you define elements within a tuple?# xWrite 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 of a dictionary?# How do you define elements within a dictionary?# Write Python commands to display for a dictionary called '''my_dictionary''' the dictionary key called '''my_key''' and a dictionary value for that key?# 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>
13,420
edits

Navigation menu