标签:always stay 嵌套 life bsp 英文 ext touch int
1、a=‘‘‘Every night in my dreams
I see you,I feel you
That is how I know you go on
Far across the distance
And spaces between us
You have come to show you go on
Near far
Wherever you are
I believe,
That the heart does go on
Once more you open the door
And you‘re here in my heart
And my heart will go on and on
Love can touch us one time
And last for a lifetime
And never let go till we‘re gone
Love was when I loved you,
One true time I hold to,
In my life well always go on
Near far,
Wherever you are,
I believe
That the heart does go on
Once more you open the door
And you‘re here in my heart
And my heart will go on and on
you‘re here,
There‘s nothing I fear
And I know,
That my heart will go on
Well stay forever this way
You are safe in my heart
And my heart will go on and on‘‘‘
a=a.replace(‘,‘,‘‘)
print(a)
b=a.lower()
print(b)
c=a.split(‘ ‘)
print(c)
统计my,heart,will,go的个数
print(‘my:{0}‘.format(a.count(‘my‘)))
print(‘heart:{0}‘.format(a.count(‘heart‘)))
print(‘will:{0}‘.format(a.count(‘will‘)))
print(‘go:{0}‘.format(a.count(‘go‘)))
2、a=list(‘1233212331‘)
for i in range(len(a)):
a[i]=int(a[i])
print(a)
#增加一个3分的
a.append (‘3‘)
print(a)
#删除最后一个
a.pop ()
print(a)
#修改第二个
a[1]=1
print(a)
#查询第三个
print(a[2])
#查询第一个3分的下标
for i in range(len(a)):
if(a[i]==3):
print(i)
break
print (‘1分的同学有{0}个‘.format(a.count(1)))
print (‘3分的同学有{0}个‘.format(a.count(3)))
3、简要描述列表与元组的异同
答:元组和列表十分类似,但是元组不能被修改,列表可以被修改。
列表是处理一组有序项目的数据结构,即你可以在一个列表中存储一个序列的项目。
列表中的项目。列表中的项目应该包括在方括号中,因此可以增加或删除项目
列表是可以嵌套的。
元组通过圆括号中用逗号分隔的项目定义。
元组也是可以嵌套的。
标签:always stay 嵌套 life bsp 英文 ext touch int
原文地址:http://www.cnblogs.com/154145kj/p/7565346.html