摘要: __author__ = 'zht' #!/usr/bin/env python # -*- coding: utf-8 -*- ''' #努力学习每一天 ''' #while嵌套应用二:九九乘法表 i = 1 while i <= 9: j = 1 while j <= i: print("%d*%d=%-5d"%(j,i,i*j),end='') ... 阅读全文
posted @ 2018-07-21 17:20 赵宏涛 阅读(581) 评论(0) 推荐(1) 编辑
摘要: __author__ = 'zht' #!/usr/bin/env python # -*- coding: utf-8 -*- ''' #努力学习每一天 ''' #计算1~100之间偶数的累积和(包含1和100) i = 1 sum = 0 while i <= 100: if i % 2: sum = sum + i i += 1 print("1~1... 阅读全文
posted @ 2018-07-21 16:56 赵宏涛 阅读(1401) 评论(0) 推荐(0) 编辑
摘要: __author__ = 'zht' #!/usr/bin/env python # -*- coding: utf-8 -*- ''' #努力学习每一天 ''' #计算1~100的累积的和(包含1和100) #1、定义变量 i = 1 sum = 0 #2、定义循环条件 while i <= 100: sum = sum + i i += 1 print("1~100... 阅读全文
posted @ 2018-07-21 16:52 赵宏涛 阅读(651) 评论(0) 推荐(0) 编辑
摘要: __author__ = 'zht' #!/usr/bin/env python # -*- coding: utf-8 -*- ''' #努力学习每一天 ''' #1、导入随机数模块 import random #2、判断输入的是否为数字 while True: try: Player = int(input("\033[1;35m请输入:剪刀(0),石头(1),布... 阅读全文
posted @ 2018-07-21 16:44 赵宏涛 阅读(165) 评论(0) 推荐(0) 编辑