WHAT’S IN THIS BOOK
书中有什么?
As you work through the projects, you’ll increase your knowledge of useful Python libraries and modules; learn more shortcuts, built-in functions, and helpful techniques; and practice designing, testing, and optimizing programs. Additionally, you’ll be able to relate what you’re doing to real-world applications, datasets, and issues.
在完成项目时,您将增加对有用的Python库和模块的知识_学习更多的快捷方式、内置函数和有用的技术_以及实践设计、测试和优化程序。此外,您将能够将您正在做的事情与现实世界的应用程序、数据集和问题相关联。
To quote Ralph Waldo Emerson, “Nothing great was ever achieved without enthusiasm.” This includes the learning experience. The ultimate goal of this book is to spark your imagination and lead you to develop interesting projects of your own. Don’t worry if they seem too ambitious at first; a little diligence and a lot of googling can work miracles—and faster than you think.
引用拉尔夫·沃尔多·爱默生的话,“没有热情就没有伟大的成就。”这包括学习经验。这本书的最终目的是激发你的想象力,并引导你开发你自己的有趣的项目。不要担心,如果他们一开始看起来太雄心勃勃_稍微勤奋一点,大量使用google可以创造奇迹,而且速度比你想象的要快。
The following is an overview of the chapters in this book. You don’t have to work through them sequentially, but the easiest projects are at the beginning, and I explain new concepts, modules, and techniques more thoroughly when they’re first introduced.
下面是本书各章的概述。您不必顺序地处理它们,但是最简单的项目才刚刚开始,并且当新概念、模块和技术首次引入时,我将对其进行更彻底的解释。
Chapter 1: Silly Name Generator
第1章:傻名字生成器
This warm-up project introduces the Python PEP8 and PEP 257 style guides as well as the Pylint and pydocstyle modules, which analyze your code’s conformance to these guidelines. The end product is a goofy-name generator inspired by the USA Network TV show Psych.
这个预热项目介绍了Python PEP8和PEP 257样式指南以及Pylint和Pydocstyle模块,它们分析代码与这些指南的一致性。最终产品是一个愚蠢的名字发生器的灵感来自美国网络电视节目心理。
Chapter 2: Finding Palingram Spells
第2章:寻找掌纹
Learn how to profile your code while saving DC Comics sorceress Zatanna from a painful death. Search online dictionaries for the magical palingrams that Zatanna needs to beat a time-reversing villain.
了解如何在从痛苦的死亡中拯救DC漫画女巫扎坦娜的同时配置代码。在网上查字典,查找扎坦纳击败一个颠覆时间的恶棍所需要的神奇的宫殿图。
Chapter 3:Solving Anagrams
第3章:解决问题
Write a program that helps a user create a phrase anagram from their name; for example, Clint Eastwood yields old west action. Then help Tom Marvolo Riddle derive his anagram, “I am Lord Voldemort,” using linguistic sieves.
编写一个程序,帮助用户从他们的名字中创建一个词组字谜_例如,克林特·伊斯特伍德产生旧的西部动作。然后帮助汤姆·马伏罗·里德尔用语言学的筛子推导出字母“我是伏地魔勋爵”。
Chapter 4: Decoding American Civil War Ciphers
第4章:美国内战密码的解码
Investigate and crack one of the most successful military ciphers in history, the Union route cipher. Then help spies on both sides send and decode secret messages using the zig-zagging rail fence cipher.
研究和破解历史上最成功的军事密码之一,联合路由密码。然后帮助双方的间谍使用曲折的铁路围栏密码发送和解码秘密信息。
Chapter 5: Encoding English Civil War Ciphers
第5章:英国内战密码的编码
Read a message hidden in plain sight by decoding a null cipher from the English Civil War. Then save the head of Mary, Queen of Scots, by designing and implementing code to accomplish the more difficult task of writing a null cipher.
通过解码来自英国内战的空密码来阅读隐藏在明视中的信息。然后通过设计和实现代码来完成编写空密码的更困难的任务,从而挽救了苏格兰女王玛丽的头。
Chapter 6: Writing in Invisible Ink
第6章:隐形墨水书写
Help a corporate mole betray Sherlock Holmes’s dad and evade detection with invisible electronic ink. This chapter is based on an episode of the CBS television show Elementary.
帮助福尔摩斯的父亲公司抓间谍,用隐形电子墨水躲避侦测。这一章是基于CBS电视节目《初等》的一集。
Chapter 7: Breeding Giant Rats with Genetic Algorithms
第7章:遗传算法育种大老鼠
Use genetic algorithms—inspired by Darwinian evolution—to breed a race of super-rats the size of female bullmastiffs. Then help James Bond crack a safe with 10 billion possible combinations in the blink of an eye.
利用受达尔文进化论启发的遗传算法,培育出雌性公牛犊大小的超级老鼠种族。然后帮助詹姆斯·邦德在一眨眼的功夫里用100亿种可能的组合破解一个保险箱。
Chapter 8: Counting Syllables for Haiku Poetry
第8章:俳句诗歌的音节计算
Teach your computer to count syllables in English as a prelude to writing Japanese poetry, or haiku, in the next chapter.
在下一章里,教你的电脑把英语中的音节数作为写日语诗歌或俳句的前奏。
Chapter 9: Writing Haiku with Markov Chain Analysis
第9章:用马尔柯夫链训练写俳句诗歌
Teach your computer to write haiku by combining the syllable-counting module from Chapter 8 with Markov chain analysis and a training corpus of several hundred ancient and modern haiku.
通过结合第8章的音节计数模块和马尔可夫链分析,以及几百个古今俳句的训练语料库,教你的计算机写俳句。
Chapter 10: Are We Alone? Exploring the Fermi Paradox
第10章:我们是孤独的吗?探索费米悖论
Investigate the absence of alien radio signals using Drake’s equation, the dimensions of the Milky Way galaxy, and assumptions about the size of detectable “emissions bubbles.” Learn and use the popular tkinter module to build a graphical display of the galaxy and Earth’s own radio bubble.
使用德雷克的方程、银河系的尺寸以及关于可探测的“发射气泡”大小的假设来研究外星无线电信号的缺乏。学习并使用流行的tkinter模块来构建星系和地球自己的无线电气泡的图形显示。
Chapter 11: The Monty Hall Problem
第11章:蒙蒂霍尔问题
Help the world’s smartest woman win the Monty Hall problem argument. Then use object-oriented programming (OOP) to build a version of Monty’s famous game with a fun graphical interface.
帮助世界上最聪明的女人赢得蒙提·霍尔问题的争论。然后使用面向对象编程(OOP)来创建一个著名游戏Monty的版本,它有一个有趣的图形界面。
Chapter 12: Securing Your Nest Egg
第12章:确保你的养老金
Plan your (or your parents’) secure retirement using a Monte Carlo–based financial simulation.
使用基于蒙特卡罗的金融模拟计划你(或你的父母)的安全退休。
Chapter 13: Simulating an Alien Volcano
第13章:模拟外星火山
Use pygame to simulate a volcanic eruption on Io, one of Jupiter's moons.
使用pygame模拟木星的其中一个卫星上的火山喷发。
Chapter 14: Mapping Mars with the Mars Orbiter
第14章:火星与火星轨道飞行器的绘制
Build a gravity-based arcade game and nudge a satellite into a circular mapping orbit without running out of fuel or burning up in the atmosphere. Display readouts of key parameters, track orbital paths, add the planet’s shadow, and spin Mars slowly on its axis, all while learning orbital mechanics!
建立一个基于重力的街机游戏,在不耗尽燃料或在大气中燃烧的情况下,推动卫星进入一个圆形的测绘轨道。显示关键参数的读数,跟踪轨道路径,添加行星的阴影,并慢慢旋转火星的轴线,同时学习轨道力学!
Chapter 15: Improving Your Astrophotography with Planet Stacking
第15章:用行星堆叠改进天体摄影
Reveal Jupiter’s cloud bands and Great Red Spot by optically stacking poor-quality video images using the Python imaging library. Learn how to work with files, folders, and directory paths using the built-in os and shutil modules.
使用Python成像库光学叠加劣质视频图像,揭示木星的云带和大红斑。了解如何使用内置操作系统和.il模块处理文件、文件夹和目录路径。
Chapter 16: Finding Frauds with Benford’s Law
第16章:用本福德定律寻找欺诈行为
Use Benford’s law to investigate vote tampering in the 2016 presidential election. Use matplotlib to summarize the results in a chart.
利用本福德定律调查2016年总统选举中的投票篡改。使用matplotlib概述图表中的结果。
|