Changes

Jump to: navigation, search

OPS435 Python Lab 3

212 bytes removed, 15:29, 30 January 2018
PART 1 - How User-Defined Functions are Declared and Run
: You will now learn how to define and run functions that will return '''string data''' when a function is called.
 
:Let's experiment with defining and running functions. Using iPython you can define and run functions in your sesion and call them from the iPython shell to test them out prior to adding them into scripts. You will learn how to do this.
:'''Perform the Following Steps:'''
:::'''Sample Run 2 (with import):'''<source>
from lab3f import * [1/1899]print(my_list)# Will print [1, 2, 3, 4, 5]
add_item_to_list(my_list)
add_item_to_list(my_list)
add_item_to_list(my_list)
print(my_list)# Will print [1, 2, 3, 4, 5, 6, 7, 8]
remove_items_from_list(my_list, [1,5,6])
print(my_list)# Will print [2, 3, 4, 7, 8]
</source>
:::2. Exit the ipython3 shell, download Download the checking script and check your work. Enter the following commands from the bash shell.<source>
cd ~/ops435/lab3/
pwd #confirm that you are in the right directory

Navigation menu