Changes

Jump to: navigation, search

OPS435 Python Lab 4

277 bytes added, 10:22, 21 June 2017
PART 1 - Strings and Substrings
def first_five():
# Place code here - refer to function specifics in section below
def last_seven():
# Place code here - refer to function specifics in section below
def middle_number():
# Place code here - refer to function specifics in section below
def first_three_last_three():
# Place code here - refer to function specifics in section below
 
if __name__ == '__main__':
:::*The script should contain '''four''' functions:
:::::'''first_five()''':<ulol><li>Accepts a single string argument</li><li>Returns a string that contains the first five characters of the argument given</li></ulol>:::::'''last_seven()''':<ulol><li>Accepts a single string argument</li><li>Returns a string that contains the last seven characters of the argument given</li></ulol>:::::'''middle_number()''':<ulol><li>Accepts a integer as a argument</li><li>Returns a string containing the second and third characters in the number</li></ulol>:::::'''first_three_last_three()''':<ulol><li>Accepts two string arguments</li><li>Returns a single string that starts with the first three characters of argument1 and ends with the last three characters of argument2</li></ulol>
:::*Example: first_three_last_three('abcdefg', '1234567') returns single string 'abc567'
::::'''Sample Run 1'''<source>
13,420
edits

Navigation menu