Changes

Jump to: navigation, search

OPS435 Python Lab 4

47 bytes removed, 09:33, 21 June 2017
PART 1 - Strings and Substrings
str(course_number)[0] # Turn the integer into a string, return first character in that string
course_code[0] + course_code[1] + course_code[2]
</source>While a list's We can use the index is numbers for each item in the list, a stringand using a technique to '''cut-out (parse)'''s index is for each character in the smaller portions within a string. In a string this This term is called referred to as a '''substring''', taking out a number of characters from the string and using . We can use this substring to either create a new string or display only a small portion of it<br><br>
:#To demonstrate, issue the following:<source>
course_name[0:4] # This will return the first four characters NOT including index 4 -> indexes 0,1,2,3 -> but not index 4
13,420
edits

Navigation menu