黑马程序员技术交流社区
标题:
几个知识点
[打印本页]
作者:
zly501
时间:
2018-10-7 20:27
标题:
几个知识点
#
TODO(
直角三角形
*
号
)
# i = 1
# while i <= 5:
# print("*" * i)
# i += 1
#
TODO(
直角三角形
*
号
)
第二种
# i = 1
# while i <= 5:
# j = 1
# while j <= i:
# print("*", end="")
# j += 1
# print("")
# i += 1
#
TODO(
矩形
*
号
)
# i = 1
# while i <= 5:
# print("*" * 5)
# i += 1
#
TODO(
矩形
*
号
)
第二种
# i = 1
# while i <= 5:
# j = 1
# while j <= 5:
# print("*", end="")
# j += 1
# print("")
# i += 1
#
TODO(99
乘法表
)
# i = 1
# while i <= 9:
# j = 1
# while j <= i:
# print("%d * %d = %d" % (j, i, i*j), end="\t")
# j += 1
# print("")
# i += 1
#
TODO(99
乘法表
)
第二种
# for i in range(1, 10):
# for j in range(1, i + 1):
# print("%d * %d = %d" % (j, i, i * j), end="\t")
# print("")
#
TODO(
剪刀石头布
)
# import random
# while True:
# player = int(input("
输入
0
剪刀
1
石头
2
布
:"))
# computer = random.randint(0, 2)
# if (player == 0 and computer == 2) or (player == 1 and computer == 0) or (player == 2 and computer == 1):
# print("
电脑出的是
%d ,
玩家赢了
" % computer)
# elif player == computer:
# print("
电脑出的是
%d ,
平局
" % computer)
# else:
# print("
电脑出的是
%d ,
电脑赢了
" % computer)# TODO(剪刀石头布 第二种)
# import random
# while True:
# player = int(input("输入 剪刀 石头 布:"))
# computer = random.choice("剪刀","石头","布")
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2