上一页 1 ··· 360 361 362 363 364 365 366 367 368 ··· 407 下一页
摘要: 1、 >>> a = ["aaa","bbb","ccc","ddd"] >>> b = reversed(a) >>> c = [] >>> for i in b: c.append(i) >>> c ['ddd', 'ccc', 'bbb', 'aaa'] 2、 >>> a = ["aaa"," 阅读全文
posted @ 2021-02-22 17:54 小鲨鱼2018 阅读(483) 评论(0) 推荐(0)
摘要: 1、 aaa = "123" answer = input("please input the answer:") while True: if answer == aaa: break answer = input("please input the answer,again:") print(" 阅读全文
posted @ 2021-02-16 19:38 小鲨鱼2018 阅读(150) 评论(0) 推荐(0)
摘要: 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 阅读(5538) 评论(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 阅读(104) 评论(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 阅读(393) 评论(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 阅读(283) 评论(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 阅读(408) 评论(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 阅读(488) 评论(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 阅读(2583) 评论(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 阅读(2266) 评论(0) 推荐(0)
上一页 1 ··· 360 361 362 363 364 365 366 367 368 ··· 407 下一页