Python

Start

First line

# -*- coding: UTF-8 -*-

Numbers

print(type(x)) # <class 'int'>
print(type(y)) # <class 'float'>
print(type(z)) # <class 'complex'>

Output

list vs tuple

Different between list and tuple is tuple is not changable.

function

def functionname([formal_args,] *var_args_tuple ):
    # do something

def sum(num, *num_list):
    sum = num
    for element in num_list:
        sum += element
    print("sum=",sum)

sum(1)
sum(1,2,3,4)

file

model

cache

file = open('/path/to/file', 'a', cache=true)

Resources