new_string = 'This is the first python live session'

new_string
new_string_ = 't' + new_string[1:]
new_string_

"""
Explanation: First Python Live session for Python for Beginners
Covering how to install Python, basics of setting up your environment and string/string manipulation
For debian based systems we want to run the following code
sudo apt-get install python3
For windows you can refer to: https://www.youtube.com/watch?v=Cd5XCrfiSv8&list=PL3GPxPa8j1HwXiyTAKZKCeGx18sTVCKCg&index=1
Strings in Python
Python strings are "immutable" which means they cannot be changed after they are created.
Since strings can't be changed, we construct new strings as we go, to represent computed values. So for example the expression ('hello' + 'there') takes in the 2 strings 'hello' and 'there' and builds a new string 'hellothere'.
Raw string r'this is a raw string'
raw strings pass all characaters to stdout and does not perform any special formatting like \n or \\
End of explanation
"""


# Unicode strings
u_string = u'A unicode \u018e string \xf1'
u_string

"""
Explanation: Unicode strings
End of explanation
"""


# ascii string
a_string = 'this\tis a ascii\nstring'
print(a_string)

# r-string or raw string
r_string = r'this is an r \nstring \t'
r_string

string1 = 'hello'
string2 = 'there'
string3 = 'Mary had a little lamb'

"""
Explanation: Ascii Strings
default when creating strings
End of explanation
"""


# to get last element
print(string1)
string1[4] 

# to get the THIRD element
print(string2)
string2[2]  

# TO get a range of elements
print(string3)
string3[0:4]

"""
Explanation: Byte String
Working with Hex/Oct/Bin String Data
Common Erros

TypeError: unicode strings are not supported, please encode to bytes

We will work with split, join, rstrip, lstrip, rfind
Slice Operator
End of explanation
"""


help(str.split)

print(string3)
string3.split()

le_falta_la_a = string3.split('a')
le_falta_la_a

"""
Explanation: Split
End of explanation
"""


help(str.join)

tiene_la_a = 'a'.join(le_falta_la_a)
tiene_la_a

string1 = ['this', 'iss', 'a', 'random', 'string']
'*'.join(string1)

"""
Explanation: Join
End of explanation
"""


help(str.rstrip)

this_is_a_string = 'adfadfds                                    '

this_is_a_string.rstrip()

"""
Explanation: rstrip
End of explanation
"""


left_spaces = '             adgfgfsgsfdgsr'
left_spaces

left_spaces.lstrip()

"""
Explanation: lstrip
End of explanation
"""


help(str.rfind)

print(string3)
string3.rfind('had ')

"""
Explanation: rfind
End of explanation
"""


'{one}{one}{one}'.format(one=5,three=3, two=4)

stringgggg = '%d%d%d' % (5,4,3)
print(stringgggg)

"""
Explanation: Formatting Strings
How to build strings properly.
End of explanation
"""


