what is a string in python code example
Example 1: pyhon string
my_string = 'Hello'
print(my_string)
my_string = "Hello"
print(my_string)
my_string = '''Hello'''
print(my_string)
my_string = """Hello, welcome to
the world of Python"""
print(my_string)
Example 2: string in python
string = "String"
string = str(string)
s1 = "Str"
s2 = "ing"
s = s1 + s2
Example 3: pyhon string
a = "Hello"
print(a)
Example 4: python string cut
string = "freeCodeCamp"
print(string[0:len(string)-1])
print(string[0:5])
print(string[2:6])
print(string[-1])
print(string[-5:])
print(string[1:-4])
print(string[-5:-2])
print(string[::2])
Example 5: strings in python
myString = "Hello world"
print(myString)
myArr = []
myArr.append(myString)
H = myString[0]
lowercase = myString.lower()
myInt = int(myString)
Example 6: Python Strings
print("Hello")