标签:div 1.4 style glob span col 全局变量 提高 int
#二分开方 x = 2 low = 0.0 high = x guess = (low+high)/2 while abs(guess**2-x) >1e-4: if guess**2 >x: high = guess else: low = guess guess = (low +high) /2 print (guess) 1.4141845703125
#局部变量,全局变量 x = 1 def f(): x = 2 print(x) f() print(x) 2 1
1 x = 1 2 def f(): 3 global x#x为全局变量 4 x = x+1 5 print(x) 6 f() 7 print(x) 8 9 2 10 2
标签:div 1.4 style glob span col 全局变量 提高 int
原文地址:https://www.cnblogs.com/tingtin/p/9853336.html