python--字符串,数值型,列表

#字符串操作
a=' abcdefg '.title()
print(a)
print(a.lower())
print(a.upper())
print(a.lstrip())
print(a.rstrip())
print(a.strip())
#数
age='18'
b="I am "+ str(float(int(age)))+"everyears hahah!"
print(b)

list=[1,2,3,4,5,6,7,8,9,0]
list.append('a')
list.insert(-1,1)
del list[-1]
list.pop(-1)

list.remove(0)
list.sort()
len(list)
for i in list:
	print(i)
min(list)
max(list)
sum(list)

squares=[value**2 for value in range(1,11)]
#定义元组
tuple=(value1,value2,value3)

  

posted @ 2019-10-07 22:41  传道授业  阅读(293)  评论(0编辑  收藏  举报