Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

48 bytes added, 16:45, 8 September 2017
LAB REVIEW
:# What is the purpose of the '''system()''' function?
:# What is the purpose of a '''list'''?
:# Assume that the following command was issued at the ipython3 prompt: '''mylist = [ 'apple', 1, 'grape', 2, 'banana', 3, ]'''<br>Based on the command issued above, what are the results of the following commands?<blockquote>'''mylist[0]''', '''mylist[3] ''' , '''mylist[-1] ''' , '''mylist[0:1]'''</blockquote>:# Assume that the following command was issued at the ipython3 prompt: '''combined_list = [ [7, 5], ['x', 'y'], [ 5, 'f' ] ]'''<br>Based on the command issued above, what are the results of the following commands?<blockquote>'''combined_list[0] ''' , '''combined_list[1] ''' , '''combined_list[1][0] ''' , '''combined_list[2][0:2]'''</blockquote>
:# Briefly explain the purpose of each of the following functions (methods) that can be used with lists: '''append''', '''insert''', '''remove''', '''sort''', '''copy'''.</li>
:# Write the '''functions''' that perform the following operations on a list:<ol type="a"><li>Returns the length of the list</li><li>Returns the smallest value in the list</li><li>Returns the largest value in the list</li></ol>
:# Write a Python script to display all of the elements within a simple list.
13,420
edits