Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

41 bytes removed, 16:43, 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?<ol type="a"><liblockquote>mylist[0]</li><li>, mylist[3]</li><li>, mylist[-1]</li><li>, mylist[0:1]</li></olblockquote>:# 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?<ol type="a"><liblockquote>combined_list[0]</li><li>, combined_list[1]</li><li>combined_lsit, combined_list[1][0]</li><li>, combined_list[2][0:2]</li></olblockquote>
:# 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