Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 1

512 bytes added, 23:32, 17 January 2019
Using Magic Functions
::*'''Boot media / Installation:''' CentOS7 Full Install DVD
:::*Download at Seneca College: CentOS 7 Full Install DVD (image file): http://belmont.senecacollege.ca/pub/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
:::*Download outside Seneca College: http://mirror.csclub.uwaterloo.ca/centos/7/isos/x86_64/CentOS-7-x86_64-EverythingDVD-1810.iso
::*'''Disk space:''' 50GB
::*'''CPUs:''' 4
=== PART 2 - Setting up Your Python Environment For Labs ===
In order to learn how to use python on your Linux machine, it is important to setup your Linux environment and learn how to interact with a Python shell. The following should be done on a terminal as the superuser (i.e. root).
pip3.4 install ipython # Install ipython for python3.4
</source></li>
<li style="margin-left:25px;">Issue Exit from the superuser shell to your regular user shell and issue the following commands in your shell to check your work for this section:<source lang="bash">mkdir -p ~/ops435/lab1/
cd ~/ops435/lab1/
pwd #confirm that you are in the right directory
:'''IPython''' is an interactive environment that allows us to run python code line by line as we write it. This will also act like a bash shell prompt allowing users to enter a limited number of Bash shell commands. You will notice this by seeing an [IN] prompt where to enter commands and an [OUT] prompt that will display output from issued commands. We will start creating scripts out of the code within this '''IPython''' environment.
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|ipython and python|[https://plot.ly/python/ipython-vs-python/ What is the difference between '''python''' and '''ipython'''?] Please note that in later labs, you can use either '''python''' or '''ipythone''' as the interactive python shell.}}</blockquote>
 
=== PART 1 - Common Ipython Commands and Features ===
:'''Perform the following steps:'''
:#Make sure you're using your regular user login and not using the root user for the following section.
:#To access the '''ipython''' shell, issue the following command:<source>
ipython3
:In this investigation we will start writing our very first python scripts. These will be very basic and help us practice syntax and foundation skills, such as: outputting text to the screen, storing data inside objects, and using math operators.
<blockquote style="margin-left:35px;">{{Admon/important|style="padding-left:25px"|Object and Variable|The terms '''object''' and '''variable''' are used to refer to a data item in computer programming. The term '''variable''' are mostly used in 3rd generation programming and /scripting languages (e.g. bash) while the term '''object''' is preferred in object oriented programming/scripting language languages like Python. In the context of Python programming/scripting, When you see the term '''variable''' in the lab instructions, it can be replaced by the term '''object'''.}}</blockquote>
1,760
edits