Scripting
Basic data
var_string = "hello"
type(var_string) # returns: class 'str'
var_integer = 3
type(var_integer) # returns class 'int'
var_float = 3.0
type(var_float) # returns class 'float'
var_boolean = True
type(var_boolean) # returns class 'bool'
print(var_string) # OK
print("My number is: " + var_integer) # Will return error as we have two different types
print("My number is: " + str(var_integer)) # Integer will be converted to string and it will be OK
Lists
list_empty = [] # Empty list
list_wdata = [3.14,"pi",3,True] # Lists can have different classes
list_wdata = [0] # Would return 3.14
list_wdata[0] = 3 # Overwrites value from 3.14 to 3
list_wdata.append(False) # Adds False to end of the list
list_empty.extend(list_wdata) # Adds one list into another
list_wdata.insert(2,9) # Inserts value 9 into 2nd position without removing any value
list_wdata.remove(3) # Would remove the first match that founds
list_wnumbers.sort() # Orders from low to high
list_wnumbers.sort(reverse=True) # Orders from high to low
Last updated