from functools import reduce i = int(input("input a number 1-10: ")) result = reduce(lambda a, b: a*b, [item for item in range(1,i+1)]) print(f'factor ...
分类:
编程语言 时间:
2020-06-06 21:41:28
阅读次数:
86
基础操作 import sqlalchemy import threading import datetime from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine f ...
分类:
数据库 时间:
2020-06-06 20:08:55
阅读次数:
84
random模块 随机小数 random.random() # 大于0且小于1之间的小数 0.7664338663654585 random.uniform(1,3) #大于1小于3的小数 1.6270147180533838 随机整数 random.randint(1,5) # 大于等于1且小于等 ...
分类:
其他好文 时间:
2020-06-06 18:56:52
阅读次数:
56
for m in range(1,22): for n in range(1,22): for p in range(1,22): for q in range(1,22): if (7-m)*(7-n)*(7-p)*(7-q)==4 and len(set([m,n,p,q]))==4: prin ...
分类:
编程语言 时间:
2020-06-06 17:04:31
阅读次数:
158
问题描述 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 n ...
分类:
其他好文 时间:
2020-06-06 16:58:28
阅读次数:
51
找规律 思路: 由题意可知,由于只能向下或向右移动,所以总共只需要走(m-1)+(n-1)= m+n-2步。而只需要确定m-1步向右的步数或者确定向下的n-1步,即可确定路径,所以共有或者种可能。 代码: class Solution: def uniquePaths(self, m: int, n ...
分类:
其他好文 时间:
2020-06-06 15:37:59
阅读次数:
68
例如在scala中的oject写个方法返回一个字符串. 该方法在java代码中使用. 好处: scala支持多行字符, 以及字符串插值 Scala和Java方法的相互调用https://blog.csdn.net/u010398771/article/details/78885009 ...
分类:
编程语言 时间:
2020-06-06 13:16:42
阅读次数:
119
TCP握手协议 在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手建立一个连接.第一次握手:建立连接时,客户端发送syn包(syn=j)到服务器,并进入SYN_SEND状态,等待服务器确认; SYN:同步序列编号(Synchronize Sequence Numbers)第二次握手:服 ...
分类:
其他好文 时间:
2020-06-06 11:17:49
阅读次数:
50
问题:Given two integers n and k, return all possible combinations of k numbers out of 1 … n. For example,If n = 4 and k = 2, a solution is: [ [2,4], [3, ...
分类:
其他好文 时间:
2020-06-06 01:16:22
阅读次数:
93
1066 Root of AVL Tree (25分) An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node diff ...
分类:
其他好文 时间:
2020-06-05 23:18:28
阅读次数:
73