#python #encoding=utf-8
a = 13
if a>10:
print 'true'
print '1233333'
else:
print 'false'
x=10
x = x+10
print x
y = 10.0 / 3
print y
z = 10 % 3
print z
#定义list集合
demoList=['123','234','678']
print demoList[1]
demoList.append('4')
demoList.insert(1,'2')
demoList.pop(0);
print demoList
print len(demoList)
#定义map集合
mapList={'key01':10,'key02':20}
print mapList['key01']
mapList['Adam'] = 67
print mapList['Adam']
#排序
strlist=['c','b','a']
strlist.sort()
print strlist
#替换字符
str01='abcdef'
str01.replace('a','A')
print str01
#取绝对值
print abs(-20)
#转化为整形
print int('12345')+1
#转化为float类型
print float(1.234)
#转化为字符串类型
print str(1.2345)
print bool(1)
#转化为布尔类型 false true
print bool(0)
#定义函数
def demoFunction(xsd):
if xsd >= 0:
return xsd
else:
return -xsd
print demoFunction(-98)
#阶乘
def sysabc(n):
if n == 1:
return 1
else :
return n*sysabc(n-1)
print sysabc(5)
#list 迭代循环
for asb in demoList:
print asb
#map迭代key
for key in mapList:
print key
#map迭代value
for mapValue in mapList.itervalues():
print mapValue
#map 迭代key和value
for k,v in mapList.items():
print (k,v)