Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 4

489 bytes added, 09:20, 14 June 2017
PART 1 - Tuples
= INVESTIGATION 1: DATA STRUCTURES =
:In this investigation, you will learn several tools when using data structures in Python scripting. :These tools include '''tuples''', '''sets''', '''dictionaries''', and more '''advanced list functions'''.
== PART 1 - Tuples ==
 
:Many often confuse a '''tuple''' with a '''list''' (which you learned about in a previous lab). A '''tuple''' is a type of list whose values cannot be changes. In fact, the structure of a tuple cannot be changed (like adding, removing list elements).
 
:There are many advantages to using tuples when creating Python scripts:
 
:*Data protection (eg. values are are NOT allowed to change like income tax rate, social insurance number, etc)
:*Tuples allow for faster access than lists
 
 
 
:A Python Tuple is a number of immutable Python values. This is similar to a list in a lot of ways, except that, the value inside cannot be changed.
:'''Perform the Following Steps:'''
13,420
edits