摘要: 1、 # prize test age = 20 score = "A" if age < 18: if score == "A": print("congratulations!!!") else: print("score not A!!!") else: print("age excess 1 阅读全文
posted @ 2021-02-06 23:06 小鲨鱼2018 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1、assert可以植入程序中进行程序检查 >>> a = 5 >>> b = 3 >>> assert a > 0 >>> assert a < 0 Traceback (most recent call last): File "<pyshell#279>", line 1, in <modul 阅读全文
posted @ 2021-02-06 23:02 小鲨鱼2018 阅读(354) 评论(0) 推荐(0) 编辑
摘要: 1、 #guess integer game import random secret = random.randint(1,10) temp = input("please input an integer:") guess = int(temp) times = 1 while (guess ! 阅读全文
posted @ 2021-02-06 20:38 小鲨鱼2018 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 1、 >>> import random >>> random.randint(1,5) 1 >>> random.randint(1,5) 4 >>> random.randint(1,5) 3 >>> random.randint(1,5) 2 >>> random.randint(10,20) 阅读全文
posted @ 2021-02-06 20:03 小鲨鱼2018 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int a[2][4][3] ={{{20,10,12},{30,20,10},{20,10,50},{20,10,30}},{{30,10,20},{40,30,10},{10,20,30},{50,10,20}}}; 阅读全文
posted @ 2021-02-06 17:20 小鲨鱼2018 阅读(455) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int i, j; int a[6][2]; puts("please input the elements of the 6 * 2 matrix."); for (i = 0; i < 6; i++) { for (j 阅读全文
posted @ 2021-02-06 14:14 小鲨鱼2018 阅读(2388) 评论(0) 推荐(0) 编辑