Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

513 bytes added, 03:52, 30 May 2017
LAB OBJECTIVES
= LAB OBJECTIVES =
 :This lab investigates methods investigate functions, lists, and loop, with a primary focus on creating reusable code. :'''<u>Objectives</u>''' :Write Python code in order to: :*'''Create reusable functions''' that can be imported by ipython3 or other python scripts :*'''Using and manipulating lists''' allows for processing a large amount of data quickly :*'''Looping through lists''' using '''Functions'''.:::Looping (iteration) is the ability for reusing your program to repeatedly run the same code with both over and over. In this case we are running a loop over a list, running functions and loopsagainst each item.<br><br>
= INVESTIGATION 1: FUNCTIONS =
max(list_of_numbers) # Returns the largest value in the list
</source>
 :#Now on to some of the more powerful features of Python lists. Searching for values inside lists and finding locations of values in a list. The index() function allows searching inside a list for a value, it will return the index number of the first occurence. <source>
number = 10
help(list_of_numbers.index)
198
edits