摘要:
例题2.18代码 from ex2_12_2 import * print(factorial(6)) fib(300) 阅读全文
posted @ 2024-10-22 21:46
等我刷把宗师
阅读(30)
评论(0)
推荐(0)
摘要:
例题2.17代码 from math import * a = sin(3) b = pi c = e d = radians(180) print(a); print(b); print(c); print(d) 阅读全文
posted @ 2024-10-22 21:45
等我刷把宗师
阅读(24)
评论(0)
推荐(0)
摘要:
例题2.16代码 from random import sample from numpy.random import randint a = sample(range(10), 5) b = randint(0, 10, 5) print(a); print(b) 阅读全文
posted @ 2024-10-22 21:44
等我刷把宗师
阅读(35)
评论(0)
推荐(0)
摘要:
例题2.15代码 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); prin 阅读全文
posted @ 2024-10-22 21:43
等我刷把宗师
阅读(24)
评论(0)
推荐(0)
摘要:
例题2.14代码 f = lambda x, y, z: x * y * z L = lambda x: [x**2, x**3, x**4] print(f(3, 4, 5)); print(L(2)) 阅读全文
posted @ 2024-10-22 21:42
等我刷把宗师
阅读(42)
评论(0)
推荐(0)
摘要:
例题2.13代码 def bifurcate_by(L, fn): return [[x for x in L if fn(x)], [x for x in L if not fn(x)]] s = bifurcate_by(['beep', 'boop', 'foo', 'bar'], lambd 阅读全文
posted @ 2024-10-22 21:41
等我刷把宗师
阅读(15)
评论(0)
推荐(0)
摘要:
例题2.12_2代码 def factorial(n): r = 1 while n > 1: r *= n n -= 1 return r def fib(n): a, b = 1, 1 while a < n: print(a, end = ' ') a, b = b, a + b 阅读全文
posted @ 2024-10-22 21:40
等我刷把宗师
阅读(15)
评论(0)
推荐(0)
摘要:
例题2.12_3代码 from ex2_12_2 import factorial, fib print('%d! =%d'%(5, factorial(5))) fib(200) 阅读全文
posted @ 2024-10-22 21:39
等我刷把宗师
阅读(19)
评论(0)
推荐(0)
摘要:
例题2.12代码 def factorial(n): r = 1 while n > 1: r *= n n -= 1 return r def fib(n): a, b = 1, 1 while a < n: print(a, end = ' ') a, b = b, a + b print('% 阅读全文
posted @ 2024-10-22 21:38
等我刷把宗师
阅读(28)
评论(0)
推荐(0)
摘要:
例题2.11_2代码 import string, random, collections x = string.ascii_letters + string.digits y = ' '.join([random.choice(x) for i in range(1000)]) count = c 阅读全文
posted @ 2024-10-22 21:36
等我刷把宗师
阅读(15)
评论(0)
推荐(0)

浙公网安备 33010602011771号