Changes

Jump to: navigation, search

OPS435 Python Lab 4

663 bytes added, 04:37, 13 June 2017
no edit summary
== PART 1 - String Basics ==
 
:We can concatenate strings using the plus sign. Combining strings together to create a brand new string, strings are immutable just like tuples. This means everytime you change a string, you are actually creating a new string.
<source>
str1 = 'Paul'
str2 = 'Atreides'
str3 = str1 + ' ' + str2
str3
</source>
 
Repetition is also a useful tool that can be used with strings. Repetition repeats the string over and over a specific amount of times. This is useful anytime you would manually be typing the same thing over again.
<source>
str1 = 'Paul'
str2 = 'Atreides'
str3 = str1 + ' ' + str2 + ' ' + 'I'
str3
str3 = str1 + ' ' + str2 + ' ' + 'I'*3
str3
</source>
== PART 1 - String Manipulation ==
198
edits

Navigation menu