Changes

Jump to: navigation, search

OPS435 Python Lab 1

132 bytes added, 13:12, 1 August 2017
Using Magic Functions
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|Unit Evaluation Scripts|Each '''Part''' (within an 'Investigation) is referred to as a '''Unit'''. Each Unit will require that the student download and run a '''Unit Evaluation Script''', which provides the OPS435 student "real-time feedback" of their completed work.<br>This feedback is not considered to be perfect or fool-proof; however, it may provide feedback (hints) in case a student gets stuck or experiences an error when performing administration tasks or when creating their Python scripts. These unit evaluation scripts can also be used to confirm that the student's Python script is on the right track, and provide a consistent record of their Python scripting progress throughout their labs.}}</blockquote>
<ol><li value="3" style="margin-left:25px;">Issue the following commands (as a regular user) in order to setup, download and run the first unit evaluation script:<br><sourcelang="bash">
mkdir -p ~/ops435/lab1/
cd ~/ops435/lab1/
:'''Perform the following steps:'''
:#The first step is to update your entire system. <sourcelang="bash">
yum update
</source>
:#Install extra packages for enterprise linux:<sourcelang="bash">
yum install epel-release
</source>
:#Next install applications that we required, first Python version 3 and version 2:<sourcelang="bash">
yum install python34 python34-devel # Install python3.4 and python3.4 development libraries
yum install python python2-devel # Install python2.7 and python2.7 development libraries
</source>
:#Next, you will install a couple of useful applications called '''tmux''' and '''screen'''. They are referred to as '''terminal multiplexers'''. If you plan to spend a lot of time in the terminal, this powerful tool will help you get it done. Lets install it and plan to use it later:<sourcelang="bash">
yum install screen tmux && ln -s /usr/bin/true /etc/sysconfig/bash-prompt-screen
</source>
:# Set your hostname to the Linux Distribution we are using in case you did not set it correctly during the install process:<sourcelang="bash">
hostnamectl set-hostname centos7 # Set your hostname to distribution-name
</source>
'''Sublime'''<br>Another powerful and popular text editor designed for programming. Is not free or open source.}}</blockquote>
<ol><li value=6" style="margin-left:25px;">'''Python pip''' is a package manager specifically for Python. While it is usually not recommended to install software outside of '''dnf''' or '''yum''', sometimes the only way to get a specific or latest version will be through pip:<sourcelang="bash">
yum install python-pip # Install python2.7 pip
yum install python34-pip # Install python3.4 pip
</source></li>
<li style="margin-left:25px;">Issue the following command to install '''git''':<sourcelang="bash">
yum install git # Install git command line tool
</source></li></ol>
<blockquote style="margin-left:35px;">{{Admon/tip|What is a Git?| '''Git''' refers to a '''version control system''' that allows you to track any changes made to files and programs. Our primary use for git in this course will be for backup onto to the internet. Check out '''bitbucket''' for a free private code repository.}}</blockquote>
<ol><li value="8" style="margin-left:25px;">IPython will be one of the tools we will use the most. Lets install it. You will learn more about it in the next section:<sourcelang="bash">
yum install python-ipython # Install ipython for python2.7
pip3.4 install ipython # Install ipython for python3.4
</source></li>
<li style="margin-left:25px;">Issue the following commands in your shell to check your work for this section:<sourcelang="bash">
cd ~/ops435/lab1/
pwd #confirm that you are in the right directory
<li style="margin-left:25px;">
Perform the following steps to evaluate this unit. Run these check scripts regularly as you work through the labs, they may give you hints if you get stuck.</li>
:<sourcelang="bash">
cd ~/ops435/lab1/
pwd #confirm that you are in the right directory

Navigation menu