Changes

Jump to: navigation, search

OPS435 Python Lab 4

12 bytes added, 09:52, 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>We You can use the a technique that uses index numbers for of a string and using a technique to '''cut-out (''' or '''"parse)'"'' smaller portions of text within a string. This term is referred to as a '''substring'''. We can use this to 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