squares = [x**2 for x in range(10)]
print (squares)
squares1 = {(x1/2) if x1>0 else 0 for x1 in range(10)}
print (squares1)
print("***mode01")
s = [print(x) for x in{"name":"john","age":30}]
print(s)
print("***mode02")
dic = {"name":"john","age":30}
s= [x for x in ({"name":"john","age":30}).values()]
print(s)
print("***vales mode")
s= [x for x in ({"name":"john","age":30}).values()]
print(s)
print("***keys mode")
s= [x for x in ({"name":"john","age":30}).keys()]
print(s)
print("***john=20 mode")
john=20
s= [x for x in ({"name":john,"age":30}).values()]
print(s)
print("***Lambda 暫時利用 FUNCTION用完即棄")
x = lambda a: a + 10
print(x(5))
john=20
s=[x for x in ({"name":john+50,"age":30}).values()]
print(s)
x = lambda a : [a+x for x in ({"name":john+50,"age":30}).values()]
print (x(100))
#"*** def FUNCTION"
#def my_func(a,b)
#my_func(10,20)
#my_func(20,10)
#"***一刀切"
import math
print (int("10"))
print (int(float("10.1")))
print ((math.floor(float("10.5"))))
print ((math.ceil(float("10.5"))))
print (round(51.23, 1)) #51.2
print (round(57.23, -1)) #60
print (round(57.23, 0)) #57
#在银行界限值(BANK RANGE)中,采用的是“大数法则(ROUND EVEN)”
#也称为“银行家舍入法(bankers' rounding)”。这种舍入方法的规则如下
print (round(1.25, 1))
print (round(1.35, 1))
from decimal import Decimal
float_number = 3.14159
decimal_number = Decimal(float_number)
print(decimal_number)
print (round(math.pi,2))
#a//b#整除
print("***a//b#整除***",-33//12)
print("IMPORT DIO")
import dio
def greeting(name):
print("HELLO," + name)
dio.greeting("Ryan")
greeting("Ryan")
from dio import greeting
greeting("Ryan") # 使用当前模块中的 greeting() 函数
def greeting(name):
print("HELLO," + name)