摘要:
`s1=[str(x)+str(y) for x,y in zip(['v']*4,range(1,5))] s2=list(zip('abcd',range(4))) print(s1); print(s2) print("学号:3005")` 阅读全文
posted @ 2024-10-28 11:56
VVV1
阅读(16)
评论(0)
推荐(0)
摘要:
`def filter_non_unique(L): return [item for item in L if L.count(item) == 1] a=filter_non_unique([1, 2, 2, 3, 4, 4, 5]) print(a) print("学号:3005")` 阅读全文
posted @ 2024-10-28 11:56
VVV1
阅读(9)
评论(0)
推荐(0)
摘要:
`a = filter(lambda x: x>10,[1,11,2,45,7,6,13]) b = filter(lambda x: x.isalnum(),['abc', 'xy12', '***']) isalnum()是测试是否为字母或数字的方法 print(list(a)); print( 阅读全文
posted @ 2024-10-28 11:55
VVV1
阅读(12)
评论(0)
推荐(0)
摘要:
`import random x=random.randint(1e5,1e8) #生成一个随机整数 y=list(map(int,str(x))) #提出每位上的数字 z=list(map(lambda x,y: x%21 and y%20, [1,3,2,4,1],[3,2,1,2])) pri 阅读全文
posted @ 2024-10-28 11:54
VVV1
阅读(15)
评论(0)
推荐(0)
摘要:
`x1="abcde" x2=list(enumerate(x1)) for ind,ch in enumerate(x1): print(ch) print("学号:3005")` 阅读全文
posted @ 2024-10-28 11:54
VVV1
阅读(13)
评论(0)
推荐(0)
摘要:
`import numpy.random as nr x1=list(range(9,21)) nr.shuffle(x1) #shuffle()用来随机打乱顺序 x2=sorted(x1) #按照从小到大排序 x3=sorted(x1,reverse=True) #按照从大到小排序 x4=sort 阅读全文
posted @ 2024-10-28 11:53
VVV1
阅读(12)
评论(0)
推荐(0)
摘要:
`from ex2_12_2 import * print(factorial(6)) fib(300) print("学号:3005")` 阅读全文
posted @ 2024-10-28 11:51
VVV1
阅读(16)
评论(0)
推荐(0)
摘要:
` from math import * a=sin(3) #求正弦值 b=pi #常数π c=e #常数e d=radians(180) #把角度转换为弧度 print(a); print(b); print(c); print(d) print("学号:3005") ` 阅读全文
posted @ 2024-10-28 11:50
VVV1
阅读(8)
评论(0)
推荐(0)
摘要:
` from random import sample from numpy.random import randint a=sample(range(10),5) b=randint(0,10,5) print(a);print(b) print("学号:3005") ` 阅读全文
posted @ 2024-10-28 11:50
VVV1
阅读(17)
评论(0)
推荐(0)
摘要:
` import math import random import numpy.random as nr a=math.gcd(12,21) b=random.randint(0,2) c=nr.randint(0,2,(4,3)) print(a);print(b);print(c) print 阅读全文
posted @ 2024-10-28 11:49
VVV1
阅读(10)
评论(0)
推荐(0)
浙公网安备 33010602011771号