kaggle learn python
def has_lucky_number(nums):
return any([num % 7 == 0 for num in nums])
def menu_is_boring(meals):
"""Given a list of meals served over some period of time, return True if the
same meal has ever been served two days in a row, and False otherwise.
"""
for meal in meals:
next = meals.index(meal)+1
try:
if meal == meals[next] :
return True
except:
return False
# else:
# return False
meals=['Spam', 'Eggs', 'Bacon', 'Spam']
menu_is_boring(meals)
为什么不能返回数据啊!!!
竟然用len(meals)-1来解决了。。。。
str = "123abcrunoob321"
print (str.strip( '' ))
result:
3abcrunoob3
以上下例演示了只要头尾包含有指定字符序列中的字符就删除
map(lambda x:x.strip(',.'),doc.lower().split())
dic 没有append 方法
# 2 decimal points 3 decimal points, format as percent separate with commas
"{} weighs about {:.2} kilograms ({:.3%} of Earth's mass). It is home to {:,} Plutonians.".format(
planet, pluto_mass, pluto_mass / earth_mass, population,
)
result:
"Pluto weighs about 1.3e+22 kilograms (0.218% of Earth's mass). It is home to 52,910,390 Plutonians."
['K']
[10 if x in'KQJ' else x for x in hand_1]
kaggle learn python的更多相关文章
- 笨办法学 Python (Learn Python The Hard Way)
最近在看:笨办法学 Python (Learn Python The Hard Way) Contents: 译者前言 前言:笨办法更简单 习题 0: 准备工作 习题 1: 第一个程序 习题 2: 注 ...
- 《Learn python the hard way》Exercise 48: Advanced User Input
这几天有点时间,想学点Python基础,今天看到了<learn python the hard way>的 Ex48,这篇文章主要记录一些工具的安装,以及scan 函数的实现. 首先与Ex ...
- [IT学习]Learn Python the Hard Way (Using Python 3)笨办法学Python3版本
黑客余弦先生在知道创宇的知道创宇研发技能表v3.1中提到了入门Python的一本好书<Learn Python the Hard Way(英文版链接)>.其中的代码全部是2.7版本. 如果 ...
- 学 Python (Learn Python The Hard Way)
学 Python (Learn Python The Hard Way) Contents: 译者前言 前言:笨办法更简单 习题 0: 准备工作 习题 1: 第一个程序 习题 2: 注释和井号 习题 ...
- 学习小计: Kaggle Learn Embeddings
Embedding表示map f: X(高维) -> Y(低维),减小数据维度,方便计算+提高准确率. 参看Kaggle Learn:https://www.kaggle.com/learn/e ...
- 快速入门:十分钟学会PythonTutorial - Learn Python in 10 minutes
This tutorial is available as a short ebook. The e-book features extra content from follow-up posts ...
- Python basic (from learn python the hard the way)
1. How to run the python file? python ...py 2. UTF-8 is a character encoding, just like ASCII. 3. ro ...
- Learn Python the hard way, ex41 来自Percal 25 号星星的哥顿人
我承认,我偷懒了,少打了大量代码(剧情),英文太差,下次可以编个中文的试试 #!/urs/bin/python #coding:utf-8 from sys import exit from rand ...
- 笨办法学Python(learn python the hard way)--练习程序31-35
下面是练习31-练习35,基于python3 #ex31.py 1 print("You enter a dark room witn two doors. Do you go throug ...
随机推荐
- mysql安装了半天参考了文章搞定了
https://blog.csdn.net/yelllowcong/article/details/79641313 mysql -uroot -pbrucelee 总结下: 1.安装时注意具体的路径 ...
- ECMA Script 6_Generator
Genertor 是一个普通函数,但是有两个特征: function 关键字 与 函数名之间有一个星号: 函数体内部使用 yield 表达式,定义不同的内部状态(yield 在英语里的意思就是“产出 ...
- linux中安装和配置 jdk
01.去官网下载指定的jdk 02.使用xftp把下载好的文件 传递到 linux指定文件夹中03.进入指定的文件夹输入tar -zxvf 文件名称04.发现文件 05.进入文件cd jdk1.8.0 ...
- 【C++ 实验六 继承与派生】
实验内容 1. 某计算机硬件系统,为了实现特定的功能,在某个子模块设计了 ABC 三款芯片用于 数字计算.各个芯片的计算功能如下: A 芯片:计算两位整数的加法(m+n).计算两位整数的减法(m-n) ...
- Dynamics 365 解决方案导出报错
之前导出解决方案异常,按照CRM社区的方法解决成功,但是没有了解原因,今天看到有朋友解答了原因,也分享给大家 先来看看异常 我那时导出的是default解决方案,这是模拟 导出异常 “业务流程错误”- ...
- POJ 2533 - Longest Ordered Subsequence - [最长递增子序列长度][LIS问题]
题目链接:http://poj.org/problem?id=2533 Time Limit: 2000MS Memory Limit: 65536K Description A numeric se ...
- linux mysql 定时备份
1.查看磁盘空间情况: 既然是定时备份,就要选择一个空间充足的磁盘空间,避免出现因空间不足导致备份失败,数据丢失的恶果! 存储到当前磁盘这是最简单,却是最不推荐的:服务器有多块硬盘,最好是把备份存放到 ...
- 使用sessionStorage进行数据存值
<!DOCTYPE html> <head> <meta charset="UTF-8" /> <meta name="view ...
- springboot+rediscluster
@EnableCaching @Configuration public class RedisConfiguration extends CachingConfigurerSupport { @Au ...
- 队列->队列的应用(银行业务模拟)
文字描述 示意图 代码实现 // // Created by Zhenjie Yu on 2019-04-13. // #include <stdio.h> #include <st ...