python-练习题

#!/usr/bin/python
# _*_ coding : utf8 _*_
# Author :army.han

# #99乘法表
# for i in range(1,10):
# for j in range(1,i+1):
# print(j,"*" ,i, "=",j*i,sep="",end=" ")
# print("\n")
#
# #斐波那契数列
#
# a,b = 0,1
# while b < 1000:
# print(b)
# a,b= b, a+b
#
# #公5文钱一只 母鸡3文钱一只 小鸡3只一文钱 用100文钱 买100文 买100只鸡
# for g in range(1,100//5):
# for m in range(1,100//3):
# for x in range(1,100):
# if g + m + x ==100 and g*5 + m*3 + x/3 ==100:
# print(g,m,x)
#
# #元组 使用enumrete 输出元素和序号
# tu = ("han","li","jiang")
# for h,y in enumerate(tu,10):
# print(h,y)
#
#
# #有一个列表找出两个元素相加等于9
# mu = [2,7,11,15,1,8,7]
#
# idx =[]
# new =[]
# for i in mu:
# for j in mu:
# if i+j == 9:
# new.append((i,j)) #这里的(i,j)看做一个元素
# idx.append((mu.index(i),mu.index(j))) #组合中的索引
# print(new)
# print(idx)

#生成200条数据,按照用户输入分页显示
us_li=[]
for i in range(1,202):
da = {"name":"han"+str(i),"Email":"han"+str(i)+".@qingyi.com","passwd":"passwd"+str(i)}
us_li.append(da)

while True:
shu = input("请输入1..21:").strip()
s = int(shu)
start = (s-1) * 10
end = s * 10
res = us_li[start:end]

for item in res:
print(item,type(item))
posted @ 2018-05-09 17:50  痒乐多多  阅读(264)  评论(0编辑  收藏  举报