Changes

Jump to: navigation, search

OPS435 Python Lab 3

54 bytes added, 08:52, 2 June 2017
PART 1 - Using Functions
text = lab3a.return_text_value()
</source>You should notice an error indicating '''"name 'lab3a' is not defined"'''. This error occurs since you failed to instruct the ipython shell to '''import''' or "load existing defined functions from your lab3a.py script" to '''internal memory'''.<br><br>
:::4. Issue the followingwithin the ipython shell:<source>
import lab3a
text = lab3a.return_text_value()
text
lab3a.return_number_value()
</source> You should notice that all of the function calls should now work. '''NOTE: ''' since you are in the ipython shell, the import command only will work as long as you are '''logged into that shell'''. You will need to use other methods (contained in other Python Scripts (or future ipython shell sessions) to make these function imports '''persistent''', but you will learn about that at a later time.<br><br>
:::5. Exit the ipython3 shell, download the checking script and check your work. Enter the following commands from the bash shell.<source>
cd ~/ops435/lab3/
:::6. Before proceeding, make certain that you identify any and all errors in lab3a.py. When the checking script tells you everything is OK before proceeding to the next step.
::Make notes for all of your observations in your lab log book, and proceed to Part 2.<br><br>
== PART 2 - Providing Functions With Arguments ==
13,420
edits

Navigation menu