摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
1、assert可以植入程序中进行程序检查 >>> a = 5 >>> b = 3 >>> assert a > 0 >>> assert a < 0 Traceback (most recent call last): File "<pyshell#279>", line 1, in <modul 阅读全文
摘要:
1、 #guess integer game import random secret = random.randint(1,10) temp = input("please input an integer:") guess = int(temp) times = 1 while (guess ! 阅读全文
摘要:
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) 阅读全文
摘要:
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}}}; 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文