上一页 1 ··· 374 375 376 377 378 379 380 381 382 ··· 407 下一页
摘要: 1、 #include <stdio.h> int main(void) { int i; puts("please input a integer: "); printf("i: ");scanf("%d",&i); if (i > 0) if(i % 2 == 0) printf("even: 阅读全文
posted @ 2020-12-27 16:43 小鲨鱼2018 阅读(1518) 评论(0) 推荐(0)
摘要: 1、else悬挂 #include <stdio.h> int main(void) { int i; puts("please input a integer."); printf("i: ");scanf("%d",&i); if (i > 0) puts("++++"); if (i == 0 阅读全文
posted @ 2020-12-27 15:39 小鲨鱼2018 阅读(215) 评论(0) 推荐(0)
摘要: >>> test1 = ["aaa","bbb","ccc","ddd","eee","fff","ggg"] >>> for i in test1: test1.remove(i) >>> test1 ['bbb', 'ddd', 'fff'] 阅读全文
posted @ 2020-12-26 22:53 小鲨鱼2018 阅读(66) 评论(0) 推荐(0)
摘要: 一、 >>> test1 = ["ccc","ddd","mmm"] >>> if test1: for i in test1: print(i) else: print("empty list") ccc ddd mmm >>> test1 = [] >>> if test1: for i in 阅读全文
posted @ 2020-12-26 22:00 小鲨鱼2018 阅读(8302) 评论(0) 推荐(0)
摘要: 1、条件成立执行 >>> a = 50 >>> if a > 10: print("xxx") xxx >>> if a < 10: print("yyy") >>> if a == 50: print("zzz") zzz score = int(input("score=")) if 100 > 阅读全文
posted @ 2020-12-26 15:48 小鲨鱼2018 阅读(533) 评论(0) 推荐(0)
摘要: zip()用于返回各个可迭代对象共同组成的元组。 >>> test1=["ccc","aaa","ddd","yyy","xxx"] >>> test2=(200,100,400,800,500) >>> test3="daceb" >>> for i in zip(test1,test2,test 阅读全文
posted @ 2020-12-26 14:48 小鲨鱼2018 阅读(1154) 评论(0) 推荐(0)
摘要: 用于生成二元组。 >>> test1 = ["xxx","yyy","ddd","ccc","aaa"] >>> enumerate(test1) <enumerate object at 0x000001C1224ED780> >>> test2=enumerate(test1) >>> type 阅读全文
posted @ 2020-12-26 14:25 小鲨鱼2018 阅读(235) 评论(0) 推荐(0)
摘要: >>> test1 = ["sss","ccc","aaa","ddd"] >>> test1.reverse() ## 就地反转 >>> test1 ['ddd', 'aaa', 'ccc', 'sss'] >>> test1.reverse() >>> test1 ['sss', 'ccc', 阅读全文
posted @ 2020-12-26 14:18 小鲨鱼2018 阅读(282) 评论(0) 推荐(0)
摘要: >>> test1 = ["ccc","aaa","aaa","ccc","bbb","aaa","ddd","aaa"] >>> test1.count("aaa") 4 >>> for i in range(test1.count("aaa")-1): test1.remove("aaa") > 阅读全文
posted @ 2020-12-26 14:06 小鲨鱼2018 阅读(988) 评论(0) 推荐(0)
摘要: 1、求最大值和最小值 >>> test1 = [34,2,5,65,322,21,54] >>> temp = test1[0] >>> for i in test1: if i > temp: temp=i >>> temp 322 >>> for i in test1: if i < temp: 阅读全文
posted @ 2020-12-26 13:52 小鲨鱼2018 阅读(3789) 评论(0) 推荐(0)
上一页 1 ··· 374 375 376 377 378 379 380 381 382 ··· 407 下一页