Li = [11,22,33,44]
def f1 (ARG):
Arg.append (55)
#函数默认返回值None, the function argument is passed a reference
Li = F1 (LI)
Print (LI)
Built-in function supplement: Determine if it is called
Def f1 ():
Pass
Print (callable (F1))
ASCII code and digital conversion
#数字转换为ASCII码
r = Chr (65)
Print (R)
#ASCII转换为数字
n = Ord (' a ')
Print (n)
Random Verification Code
Import Random
List_temp =[]
For I in range (10):
R = Random.randrange (0,10)
if r = = 2 or R = = 4 or R = = 9:
num = Random.randrange (0, 10)
List_temp.append (num)
Else
temp = Random.randrange (65, 91)
c = Chr (temp)
List_temp.append (c)
result = "". Join (List_temp)
Print (Result)
Compile, execute
s = "Print (123)"
#编译: Single, eval (expression), exec (compiled into Python)
#将字符串编译成python代码
R = Compile (s, "<string>", "exec")
#exec执行python代码, no return value
EXEC (R)
#eval只执行表达式, there are return results
box = "8 * 8"
ret = eval (box)
Print (ret)
Day4 built-in function supplement, adorner