Please enable JavaScript.
Coggle requires JavaScript to display documents.
Python Course - Coggle Diagram
Python Course
Strings
name="xxx"
print(f"Hello {name}")
a="xxx "
print(a)
a="xxx " b="xxx" c="xxx"
print(a, b, c)
print("XXX")
(Single Quotes) 'xxx'
(Double Quotes) "xxx"
(Triple Quotes AKA multi-line strings) """xxx"""
(Hashtag) # = to ignore the line use # at the beginning of the line
(Backslash AKA scape character) \ before ' or " or """ = ignoring the ' = example: 'Hi I\'m here'
Command Prompt
cd = show directory
cd .. = move to the previous directory
cls
mkdir = make directory
python ScriptName.py = to run the python script
dir = list
D: = go to D drive
Indexing & Slicing
name="Interstellar" = to index
Print(name[0]) or Print(name[-12])
print(name[start:stop+1])
print(name[start:]) = stop is empty which means to the end
print(name[:5]) = start is empty which means from 0
print(name[:]) = start and stop are empty which means the whole string
print(name[start:stop+1:step size])
print(name[0:12:2]) = Itrtla
print(name[0:12:-1]) = reverse = ralletsretni
print (len(name)) = to print the length of the variable
print (type(name)) = to print the type of the variable
print (id(name)) = to print the memory location of the object