第三天习题

# count = 0
# for i in range(1, 9):
#     for v in range(1, 9):
#         if i != v:
#             count += 1
# print(count)
#####print('',sep=,end=) sep 分割符
# 九九乘法表
# 法1
# for i in range(1, 10):
#     s = ''
#     for v in range(1, i + 1):
#         c = i * v
#         s += str(i) + str('*') + str(v) + str('=') + str(c) + '\t'
#     print(s)
# 法2
# for i in range(1, 10):
#     for v in range(1, i + 1):
#         c = i * v
#         print(i,'*',v,'=',c,end='\t')
#     print('\n',end='')


# li = [1, 3, 4, 2, 5, 6]
# for i in li:
#     for v in li:
#         if i != v:
#             c = str(i) + str(v)
#             print(c)

# 一键买鸡
# for b in range(1,100//5):  # 条件能减少循环的次数
#     for c in range(1,100//3):
#         for d in range(1,100):
#             if 5*b + 3*c+1/3*d ==100 and b + c + d==100:
#                 print(b, c, d)

# 下划线拼接元素
# li = ['dfas','rew',12321,4324]
# string = ''
# for i in range(0,len(li)):
#     li[i] =str(li[i])
# li1 = '_'.join(li)
# print(li1)

#打印和为9
# nums = [2,3,5,4,7,3,1,8]
# a = []
# for i in nums:
#     for v in nums:
#         if i + v ==9:
#             a.append((i,v))
# print(a)###重复问题如何解决

#for循环显示301条数据
user_list = []
for i in range(1,302):
    s = 'alex-{}    alex{}@live.com     pwd{}'
    v = s.format(i,i,i)
    user_list.append(v)
page = input('请输入页码:')
page1 = int(page)
s1 = user_list[page1-1:10*page1]
print(s1)

 

posted @ 2018-02-11 11:50  MrZY  阅读(119)  评论(0编辑  收藏  举报