Python
datatypes
tuple
dictionary
string
What is it?
A thing that holds a list of characters. Why do I say a list? Because its true! You are able to use the same index option in the #list datatype when issuing a fetch of a value by an index number (eg. mystring[1]
to get the second character of the object called mystring
).
When to use it?
Pretty much when ever you want hold a list of
How to use it?
In [1]: mystring = "hello aaron"
In [2]: mystring[1]
Out[2]: 'e'
In [3]:
integer
What is it?
A thing that holds whole numbers or float numbers
When to use it?
To hold numbers or do maths.
How to use it?
# create an integer
myint = 123
list
What is it?
A thing that holds a list of things and allows for referencing by an index or position or range of some items.
When to use it?
These are great for holding things in an order (or can be unordered) to hold some data. You can define these in a couple of different ways.
How to use it?
# a blank list
mylist = []
# adding to a list
mylist.append('value')
# get the first item
mylist[0]
# get the last item
mylist[-1]
logic
if-else
try
classes
dataclasses
I really like the dataclasses
and while they can be a little confusing at first, they do cover lots of boilerplate code.
The following are some examples I have for how to use this really cool object:
stackdump and debug
stackdump
How to read it?
…
debug
What can I do to improve debugging?
…