Strings in Python

my_str = 'Hello World'
string = "Hello"

String Concatenation

str1 = 'Hello'
str2 = 'World'
#This will print out Hello World
8 + 'hello'
# This will give an error
but we can do this using an str() function and it will convert the the int into str then you can concatenate
string = "Cat"
string += " Dogs"
#This will print out Cat Dogs

Formatting Strings

There's a new method to interpolate the strings * The method is called the F-strings this will help you convert the int value into a string

x = 10
print(f"I have told you " {x}  times to clean the floor correctly")
# This will print I have told you 10 times to clean the floor correctly
# This a new way of interpolating string 
y = 'I have told you {x} times to clean the floor correctly'.format(x)
# This an old way of doing it and its applicable in python 2.7

String Index

x = "Hello"
#This will print out H 
# [] We use this for index
# This is useful for lists

Converting DataTypes

x = input('What is your age') #this will prompt to the user
print(x) # whatever user types it will be printed out