# /pycode code demo 1
__author__ ="Handel liao 20160505"
#simx1
#=====================================
print ("=====string and number =====")
a =33
b = "abc"
c =12.1
print ("hello")
print (a)
print (b)
print (c)
print (a+c)
#=====================================
print ("===== python logic shift ===")
print (a<<1 p="">print (a/4)
print (a>>1)
print (a%4)
#=====================================
print ("====Array show =============")
a=['apple','welcom','car','table','telephone','tv','pc','nb']
for x in a:
print (x,a.index(x))
print ("len = ",len(a))
print ("min = ",min(a))
print ("max = ",max(a))
print ("befert sort => ",a)
a.sort()
print ("after sort => ",a)
# /pycode code demo 2
__author__ ="Handel liao 20160505"
#simx2 by def test
#=====================================
print ("====function call ===================")
def fun1():
print ("this is fun1 !")
def fun2(num):
print ("this is fun2 = " + str(num))
def fun3(num1,num2):
num3 = num1+num2
print ("this is fun3 by "+str(num1)+"+"+str(num2)+"="+str(num3))
return num3
#=====================================
print ("=============================")
fun1()
fun2(100)
yy = fun3(10,22)
print ("add fun => ",yy)1>
沒有留言:
張貼留言