上一页 1 ··· 320 321 322 323 324 325 326 327 328 ··· 367 下一页
摘要: 1、for 循环 >>> sum = 0 >>> for i in range(101): sum += i >>> print(sum) 5050 2、while循环 >>> sum = 0 >>> i = 0 >>> while i <= 100: sum += i i += 1 >>> pri 阅读全文
posted @ 2021-02-15 22:07 小鲨鱼2018 阅读(4964) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(93) 评论(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 阅读(350) 评论(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 阅读(254) 评论(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 阅读(388) 评论(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 阅读(429) 评论(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 阅读(2219) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int a[4][3] = {{2,5,4},{1,2,4},{5,3,2},{4,2,6}}; int b[3][4] = {{2,1,6,2},{3,2,4,1},{5,2,1,2}}; int i, j, k; in 阅读全文
posted @ 2021-02-05 23:49 小鲨鱼2018 阅读(2089) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int a[4][3] = {{50,60,40},{80,70,60},{60,70,70},{90,80,70}}; int b[4][3] = {{40,60,80},{20,70,90},{60,80,90},{5 阅读全文
posted @ 2021-02-05 14:10 小鲨鱼2018 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> # define NUMBER 80 int main(void) { int a[NUMBER]; int number; puts("please input the number of the student."); do { printf("num 阅读全文
posted @ 2021-02-04 18:48 小鲨鱼2018 阅读(406) 评论(0) 推荐(0) 编辑
上一页 1 ··· 320 321 322 323 324 325 326 327 328 ··· 367 下一页