python习题
lmfors
这个作者很懒,什么都没留下…
展开
-
2020-09-27
例题4,8个教师随机入住3个房间import randomoffices = [[], [], []]names = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']for name in names: index = random.randint(0, 2) offices[index].append(name)for i, office in enumerate(offices): print('办公室%d有%d人。' % (i, l原创 2020-09-27 16:46:38 · 65 阅读 · 0 评论 -
2020-09-27
例题3购物车小程序products = [['iphone', 6888], ['MacPro', 14800], ['小米8', 2499], ['Coffee', 31], ['book', 60], ['Nike', 699]]print('-' * 6 + ' 商品列表 ' + '-' * 6)for i, element in enumerate(products): print(i, '\t', element[0], '\t', element[1])shoping_car原创 2020-09-27 15:53:22 · 102 阅读 · 0 评论 -
2020-09-27
九九乘法表for i in range(1, 10): for j in range(1, i + 1): print('%d*%d = %d' % (j, i, i * j), end=' ') print('\n')原创 2020-09-27 15:29:09 · 54 阅读 · 0 评论 -
例题1猜拳小游戏
学习目标:python爬虫基础学习内容:例题1猜拳小游戏学习产出:# -- codeing = utf-8 --@Time : 2020/9/25 16:58@Author : lmfors@File : fingerguessing.py@software: PyCharmimport randomwhile 1:computer_number = random.randint(0, 2)user_number = int(input(‘please input 0(石头)原创 2020-09-27 09:38:50 · 142 阅读 · 0 评论