first day of python--类型

# -*- coding: utf-8 -*-

#print absolute value of an integer:

# a = raw_input('请输入a的值:'.decode('utf-8').encode('gbk'))

# a = int(a)

# if a >= 0:  #使用“:”冒号并配合缩进来表示代码块

# print a

# else:

# print -a

# print u'测试中文输出'

# ##=================================================================

# #测试占位符

# print 'ENGname:%s CHNname:%s Age:%d salary:%d' %('ArmedYang',u'杨', 21, 1111)

# ##=================================================================

# #测试list使用

# workmates = ['sunjiayao','dufen','wangxianyuan','lidongyang','dingxuyong','zhoufeng','zhangchen']

# a = len(workmates)

# print a

# print 'first mate'

# print workmates[0]

# print 'last mate'

# print workmates[-1]

# print 'add new mate'

# workmates.insert(0,'yangjiahui')

# workmates.append('somebodyelse')

# print 'show new group'

# print workmates

# print 'remove somebody'

# print workmates.pop(-1)

# a = len(workmates)

# print a

# workmates.append(['teacher ai','teacher chen'])

# print 'the teacher of this group is %s and %s' %(workmates[-1][0],workmates[-1][1])

# for mate in workmates:

# print mate

# ##=================================================================

# #测试tuple使用

# workleader = ('chen','ai',[])

# ###workleader.append is forbidden since its a tuple and cannot be modified,but workleader[2] is an empty list which can be modified

# workleader[2].append('leader1')#append takes exactly one arguement

# for leader in workleader:

# print leader

# ##=================================================================

# #测试死循环drop-dead

# a = range(5)

# print a

# b = raw_input('press any key to get start this endless loop')

# while a:

# print 'im drop deading'

# ##=================================================================

# #测试dict和set

# holiday = {'spring fes':101, 'fool\'s day':401, 'children\'s day':601,}

# print holiday['spring fes']

# print 'my birth' in holiday

# print holiday.get('my birth','not exist')

# holiday['my birth'] = 1207

# print holiday.get('my birth','not exist')

# holiday.pop('fool\'s day')

# print holiday

# week = set(range(1,8))

# print week

# week.add(7)

# #when add a element already exist,the set wont change

# print week

# workday = week.copy()#create a copy of set week

# #and workday = week won't work since when you modify workday will also change week

# weekend = set([6,7])

# for zhoumo in weekend:

# if zhoumo in workday:

# workday.remove(zhoumo)

# print workday

# print week

# print week == (workday | weekend)

import math

print math.pi

你可能感兴趣的:(first day of python--类型)