Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

202 bytes added, 08:43, 3 June 2017
PART 1 - Navigating Items in Lists
:#Create a Python script called: '''~/ops435/lab3/lab3e.py'''<br>The purpose of this script is to have a number of functions that output a different data storage in various elements of a list. Each function will return either a single item from the list OR will create a new list and return the entire new list.<br><br>
:#The template function names and the special if statement:<source>
#!/usr/bin/env python3 # Create the list called "my_list" below this command (not within any function defined below) 
def give_list():
# Create the list called "my_list"Does not accept any arguments
# Returns the entire list unchanged
def give_first_item():
# Does not accept any arguments
# Returns a single string that is the first item in the list
def give_first_and_last_item():
# Does not accept any arguments
# Returns the a list that includes the first and last items in the list
def give_second_and_third_item():
# Does not accept any arguments
# Returns the a list that includes the second and third items in the list
13,420
edits