Professional Documents
Culture Documents
Python - Part III
Python - Part III
String Manipulation
1. String Concatenation.
2. Accessing a single character in a certain position in a string.
3. Slicing.
String Concatenation
❖ String concatenation is the process of merging multiple string values into one string value.
❖ Example:
Code Output
firstName = "Sudam" [Keep this space]
lastName = "Perera"
print(fullName01)
print(fullName02)
❖ So, to access a single value in a string we can use the index number of the position.
❖ Example:
Code Output
name01 = "Sudam Perera" [Keep this space]
print(name01[2])
Slicing a string
❖ Slicing is getting a subset (a part) of a string using starting and ending index numbers.
❖ Example 01:
not Operator
❖ Negates the logical result.
Result not(Result)
True False
False True
and Operator
❖ Both conditions have to be true in order to final result be true.
or Operator
❖ At least one condition must be true in order to final result be true.