- 博客(8)
- 收藏
- 关注
原创 我陪小翟刷Hackerrank
我陪小翟刷Hackerrank前言各种函数列表(list)功能快捷键 前言 被准备零基础转码的小翟拉着刷Hackerrank上的python3,在这里记录一下我遇到过的问题(毕竟自己之前没有学过py)。有些函数可能之前用过但是并不很了解,在这里一并记下。 各种函数 map()函数 在这里插入代码片 print()函数,sep参数和end参数 # sep参数表示两个输出之间的分割 prin...
2020-03-20 22:51:40 201
原创 deep learning project3 语法、用法总结(pytorch)
多元素比较用.all()或者.any()。例如: import numpy as np a = np.array([1, 2, 3]) b = np.array([1, 2, 4]) if a == b: print('Yes!') else: print('No!') 报错:ValueError: The truth value of an array with more ...
2018-12-11 19:35:33 365
原创 Matlab笔记1(未完成)
[B, index] = sort(A) % B是排序后的内容,index是B的索引 % 下面是例子 A = [1.2, 3.5, 2.4]; [B, index] = sort(A); >>> B = [1.2, 2.4, 3.5] >>> index = [1, 3, 2] % index为B中元素在A中的位置 % 类似的还有max和min [m, ...
2018-02-16 22:47:31 193
原创 Latex笔记1
% 插入图片 \usepackage{graphicx} \includegraphics[scale=0.8]{pj1_1.jpg} % 这里scale 表示图片整体大小 % 第二个变量为图片相对路径,要和.tex文件在同一个文档% 插入代码 \usepackage{listings} \usepackage{xcolor} % 写在begin{document}之前 \lstset {
2017-10-05 23:11:24 359
原创 Python笔记1——以numpy包为主
# 数组是不能转置的 a = np.array([1, 2, 3]) # a.shape = (3, ) b = np.array([[1, 2, 3]]) # b.shape = (1, 3) c = a.T # c.shape = (3, ) d = a.T #d.shape = (3, 1) # 可以用reshape处理 e = b.reshape(-1, 1) #变成一列的向量
2017-10-05 22:49:38 209
原创 R语言笔记1
# 生成一个长度为n的,元素全为0的向量 zero.vector # 判断向量中是否有某元素 > vec <- c(1,3,2,6) > 3 %in% vec [1] TRUE > 4 %in% vec [1] FALSE # 统计某个向量中所有元素的出现次数 # table函数 test <- c(1, 2, 3, 4, 5, 4, 3, 2, 1, 1) t.test <- table
2017-10-02 22:54:10 443
转载 列表解析式
内容选自如下网站:http://www.jianshu.com/p/c635d3c798c2 用来生成列表、速度比for循环快(这一点我还没验证过) 直接上例子:#无条件形式 #获取文本中所有单词的第一个字母 >>> text="My house is full of flowers" >>> first_chart=[word[0] for word in text.split()
2017-07-19 15:07:21 286
原创 用‘/’运算后,无论结果,返回值为float
例如:def Calculate_Medium(scores): length=len(scores) if length%2==0: return (scores[length/2]+scores[length/2+1])/2#报错 else: return scores[length//2] 报错为:list indices must
2017-07-15 16:28:25 337
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人