Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 2

63 bytes removed, 10:41, 22 January 2018
PART 1 - Using IF Statements
:#Use a temporary file for testing your work for this section.
:#In order to read arguments in Python, we will need to '''import special variables''' from the system. This is a standard 'library' of code provided by the developers of Python. By issuing '''import sys''', you have loaded code written by another person, each 'library' that gets loaded will give us extra functionality in our program. This is done by issuing the import sys function within your ipython3 shell.<br><br>
:#Start with the following line to import special variables:<source>
import sys
</ol>
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|Number of Arguments with len(sys.argv)|If you are running calling the '''len()''' function with the '''sys.argv)''' function in ipython3argument, the number of arguments returned will be always be '1'. This number will always be one higher than the actual number of arguments entered, since it also counts the script name as a argument.}}</blockquote>
''' Practice Using IF Statements'''