自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 收藏
  • 关注

原创 leetcode - Lemonade Change

问题描述At a lemonade stand, each lemonade costs $5.Customers are standing in a queue to buy from you, and order one at a time (in the order specified by bills).Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must p

2020-06-02 21:22:14 162

原创 leetcode - Goat Latin (24ms)

问题描述**A sentence S is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only.We would like to convert the sentence to “Goat Latin” (a made-up language similar to Pig Latin.)The rules of Goat Latin are as

2020-06-02 02:53:39 171

原创 leetcode -Two Sum

问题描述Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.example:Given nums = [2, 7, 11, 15]

2020-06-01 04:42:10 155

原创 leetcode 之 Add Two Numbers(链表)

问题描述:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.You may assume the two numbers

2020-06-01 04:19:35 98

原创 MySQL macOS安装教程

1. SQL是什么?SQL是指结构化查询语言,数据库的一种查询方式。2. MySQL是什么?MySQL是市面上的一种关系型数据库之一,主要特点是体积小、速度快、社区版开源免费;是目前最流行的关系型数据库管理系统(RDBMS)。Oracle是世界上第一个支持SQL语言的商业数据库,应用广泛,功能强大。3. 目前互联网上非常流行的网站构架组合是LAMPL:LinuxA:ApacheM:MySQLP:PHP...

2020-05-29 20:32:21 186

原创 APIC_EM REST API URLs

1. URL的组成部分:https://fqdn-Or-IPofController/api/v1/api_itself其中:1、https://fqdn-Or-IPofController是基本URL,如有需要,URL中还可以加上端口号;2、api/v1/是指REST API的版本号3、/api_itself是指API的端口2. 如何使用python发出HTTP请求?HTTP - “CRUD”方法去创建、读取、更新和删除数据:POST - 创建数据GET - 读取数据PUT

2020-05-23 23:39:42 190

原创 mac终端无法安装python库、‘ssl module is not available’的解决方法

“pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.”安装python库的时候,出现以上提示语,无法完成安装如:pip3 install requestspip3 install netmiko解决方法:重装python(虽然mac终端自带python编译器)brew reinstall pythonpython重装后,问题就可

2020-05-23 20:52:35 602

原创 求最长回文字符串常用的算法

1. 最长回文串的定义1、回文串是指正读和反读都一样的字符串;如:levelnoon2、最长回文串:即给定一组字符串,求其最长回文串的长度;如:给定:azbcbac最长回文串:abcba2. Brute-force(暴力破解算法)1、原理:列举字符串中的所有子串,并判断它们是否为回文串;2、时间复杂度:O(n^3);长度为n的字符串共有n^2个子串,而子串的平均长度为n/2。插入一个常用算法的时间复杂度和空间复杂度的表:排序法平均时间最差情况稳定度额外空间

2020-05-19 21:26:52 714

原创 python-os模块和hashlib模块

获取目前所在目录:import osos.getcwd()返回给定目录及其子目录的所有文件名:def walk(dirname): for name in os.listdir(dirname): path = os.path.join(dirname,name) if os.path.isfile(path): #判断该路径是否为一个正常的文件 print(path) else: #如果该路径不是文件,则继续递归 walk(path)查找重复文件:思路:可以

2020-05-14 07:42:14 148

原创 python - set函数

set函数:去除列表中多余的项例子:example = [1,2,1]a = set(example)print(a)print(type(a))输出:{1, 2}<class 'set'>set函数返回的是set数据类型,而且set数据类型可迭代:for i in a: print(i)输出:12也可转换为list或者tuple:print(list(a))print(tuple(a))输出:[1,2](1,2)...

2020-05-14 06:09:33 166

原创 python-计算文本中每个单词的出现频率

数据处理计算文本中每个单词的使用频率,并从高到低进行排序from string import punctuation#打开数据导入text = open('text.txt')def count(text): dic = dict() #创建新字典 for line in text: word = line.split() #将字符串分割为list,默认分隔符为空格 for item in word: item = item.strip(punctuation) #数据处理,

2020-05-14 05:59:57 4954

原创 python-查找相同元素

查找相同元素:如 ‘ organization’ 和 ‘ train ’ 有共同元素 ‘t’, ‘r’, ‘a’, ‘i’, 'n’#上传单词列表from google.colab import filesfiles.upload()text = open('words.txt')def is_my_name(text): for line in text: line = line.strip() count = 0 for i in line: if

2020-05-12 10:34:50 742

原创 python查找单词列表中相同字母组成的不同单词

单词列表的链接:words.txt列表中一共有11.3万个单词,.txt文件格式,是一个很好的素材库。问题:如何在单词表中,查找相同字母组成的不同单词?输出结果的例子:[‘aals’, ‘alas’][‘baals’, ‘balas’, ‘balsa’]# 打开单词列表 words.txttext = open('words.txt')#计算单词中各字母的频率,如‘apple’,{'a':1, 'e':1, 'l':1, 'p':2}def most_frequent(st): di

2020-05-11 07:37:21 2539 3

原创 Git命令总结

1. 安装Git下载网址:https://git-scm.com/downloads ➡️ Click memacOS安装Homebrew方法:1、网址:https://brew.sh/index_zh-cn ➡️ Click me2、将以下命令复制粘贴到终端:/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Hom...

2020-05-07 22:55:14 366

原创 python之关于matplotlib画图的函数(含matplotlib安装方法)

题目:使用matplotlib库里的相关函数,完善图表要求:1、给图表添加标题 ”Results of 500 slot machine pulls“;2、让y轴从0开始;3、给y轴添加标签 ”Balance“;4、将y轴刻度的格式改为美元,如 $200;如果大家电脑里没有安装matplotlib,代码是无法运行de!这里给出一个安装方法(macOS系统):1、先安装numpy(如...

2020-05-06 09:44:07 316

原创 python中的library(库)

Reference: Working with External Libraries Click me!本节将讨论python中库的导入以及介绍部分常用的库和它们所返回的对象。1. 导入(imports)我们之前有学过数据类型、自定义内置函数等,但python中最美好的事情大概是它所自带的库了吧;有一些库称为“标准库”,可以轻松调用;但有一些库必须使用 ”imports“ 导入;我们来看...

2020-05-04 03:54:35 8999

原创 python之关于字符串、字典的那些事

python关于字符串(strings)、字典(dictionaries)的那些事????Reference: Kaggle Notebook! Strings and Dictionaries! Click me!1. 字符串(strings)本小节将介绍一些python中关于内置字符串的方法和格式,这种字符串操作模式经常会在数据分析工作中碰到,非常实用哦!跟着我一起学习吧;A. 语法下面是...

2020-05-03 04:36:08 263

原创 python之有关循环的那些事儿

Python for和while循环语句的基础知识!小白请看过来,纯干货!!Reference: Kaggle Notebook Loops! Click me!1. 循环(Loops)循环在计算机语言中是指重复运行某些代码。看看例子就懂啦~planets = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uran...

2020-05-02 09:47:14 506 2

原创 如何查找列表中的数列

1、如何查找列表中的某一个值?数列中的元素可以是数字,也可以是字符串,同时可以是一组数列。直接看例子:>>> example = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]>>> example[-1][1] #查找最后一组数列(-1)中的第2位元素(1)82、如何确定在列表中是否存在某个元素?f...

2020-05-02 06:42:56 592

原创 python之数据结构的那些事儿

python之数据结构的那些事儿Reference: Kaggle Notebook Lists! Click me!本节主要学习python中最基础的数据结构 - lists 和 tuples1. Lists(数列)Lists是指一组有序的元素;例子:primes = [3, 7, 12, 4]但Lists中不是只可以放数字,还可以放字符串;例子:planets = [‘...

2020-05-01 11:45:02 236

原创 Hello GitHub!初次见面,请多多指教

如何创建GitHub存储库以及pull requestReference: GitHub Guides Hello GitHub! Click me!本文主要介绍GitHub的基础知识,包括存储库(Repository)、分支(Branch)、提交(Commit)和请求(Pull Request);并介绍如何创建属于自己的Hello World存储库 + Pull Request的工作流程。...

2020-04-30 11:12:03 615

原创 python之布尔值(Booleans)和if条件语句

python之布尔值(Booleans)和if条件语句Reference: Kaggle Notebook Booleans & conditionals! Click me!1. 布尔值(Booleans)问题1: 什么是Booleans?先看看代码:x = Trueprint(x)print(type(x))输出:True<class 'bool'>...

2020-04-29 08:10:33 12342 1

原创 python函数中默认参数的补充

python函数中默认参数的补充题目:糖果平均分,为了公平起见,剩余的糖果需销毁;如果没有特别设定,默认平均分给3个人。代码如下:def to_smash(total_candies, number_of_friends = 3): """Return the number of leftover candies that must be smashed after distri...

2020-04-28 11:26:55 195

原创 python小白之有关函数的那些事

python小白之第二节-有关函数的那些事Reference: Kaggle Notebook Functions and Getting Help! Click me!上一节有提到过print()函数,但是其实除此之外,python还有好多好多的函数,而且还支持自定义函数。今天就学一下如何调用已知函数又或者自定义函数首先,在正式学习之前,我们先看看如何向python寻求帮助(Gettin...

2020-04-28 10:56:13 231

翻译 python-数据分析小白自学记

**python-数据处理小白自学记Reference: Kaggle Notebooks Hello, Python! Click me!(说明:本文主要介绍与数据分析相关的python相关知识)ps:原来Python是以英国喜剧团Monty Python命名~首先我们先看一段小代码:spam_amount = 0 #创建变量spam_amount,并赋值0print(spam_...

2020-04-27 06:06:26 732 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除