Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

340 bytes added, 10:36, 31 May 2017
PART 1 - Using Functions
: 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. One neat thing with using scripting languages like Python or Bash, is that you can define and run functions from the shell and call them from the shell to test them out prior to adding them into scripting files. You will learn how to do this first in your ipython3 shell, and then incorporate them into your Python script files to run.
:'''Perform the Following Steps:'''
 :#Let's experiment with defining and running functions.To start, open the ipython3 shell:<source>
ipython3
</source>Whenever you want to create a function, you must start with the keyword "'''def'''". The '''def''' keyword is used to start the definition of the function, it does not run the code you write. Functions, just like if statements, must have all code under them indented.<br><br>
13,420
edits