LearnPython3theHardWay
byakki
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LearnPython3theHardWay__Excercise 14 Prompting and Passing
知识点:argv input让我们做一个练习,用上 argv 和 input和简单的提示语。进行简单的人机交互。from sys import argvscript, user_name = argvprompt = '> 'print(f"Hi {user_name}, I'm the {script} script.")print("I'd like to ask you...原创 2019-01-31 09:47:37 · 336 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 25 Even More Practice
这一节我们更多的练习函数编程。原创 2019-02-06 16:37:45 · 359 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 36 Designing and Debugging
原创 2019-02-15 16:08:30 · 272 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 37 Symbol Review
原创 2019-02-15 16:34:13 · 207 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 26 Congratulations,Take a Test!
我们学习的进度已经完成了一半了。接下来将来一个测验!修复下面的代码print("How old are you?", end=' ')age = input()print("How tall are you?", end=' ')print("How much do you weigh?", end=' 'weight = input()print(f"So, you're {ag...原创 2019-02-07 23:05:51 · 271 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 27 Memorizing Logic
建议ex27-31连起来学习今天开始学习逻辑True or False, 对于零基础的同学,要求做到一看到就能说出真或假,因为程序员每天都需要逻辑。作者建议我们弄个卡片,把相关词语写在上面,有空就拿出来看并立即说出真或假。我们用以下字符来判断 True 和 Falseandornot!= (not equal)== (equal)>= (greater-than-e...原创 2019-02-08 13:51:57 · 206 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 28 Boolean Practice
建议ex27-31连起来学习布尔表达式的练习我们在IDLE里把下面的代码一行一行打出来并看结果,请先想想答案再按ENTERTrue and TrueFalse and True1 == 1 and 2 == 1"test" == "test"1 == 1 or 2 != 1True and 1 == 1False and 0 != 0True or 1 == 1"test" ...原创 2019-02-08 14:22:20 · 185 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 29 What If
建议ex27-31连起来学习原创 2019-02-08 15:02:27 · 182 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 30 Else and If
建议ex27-31连起来学习原创 2019-02-08 15:20:39 · 164 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 31 Making Decisions
建议ex27-31连起来学习原创 2019-02-08 15:35:47 · 308 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 38 Doing Things to Lists
&原创 2019-02-16 13:24:14 · 245 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 39 Dictionaries, Oh Lovely Dictionaries
**原创 2019-02-16 16:21:00 · 225 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 24 More Practice
回顾一下我们学习了什么:print(),注释,算术运算,变量代入到print(),字符串的运算,格式化,转义字符,input(),文件的读写,函数编程def我们将结束第一阶段的学习。我们应该有足够的能力去更进一步了解程序是怎么执行的,但我们还需要更多更长的练习,为的是培养耐心。开始吧。边打边回顾学过的内容print("Let's practice everything.")print('Yo...原创 2019-02-05 22:35:03 · 239 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 40 Modules, Classes, and Objects
原创 2019-02-17 01:52:11 · 255 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 41 Learning to Speak Object-Oriented
原创 2019-02-17 18:36:56 · 316 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 42 Is-A, Has-A, Objects, and Classes
原创 2019-02-18 00:28:27 · 384 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 32 Loops and Lists
知识点:for , range, list今天开始学 for 循环。在使用for之前,我们需要找个容器来存储循环后的结果。最好的方法就是用列表。首先,我们创建列表:hairs = ['brown', 'blond', 'red']eyes = ['brown', 'blue', 'green']weights = [1, 2, 3, 4]列表用中括号,把元素包起来现在我人产创建一些列...原创 2019-02-13 23:42:16 · 187 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 33 While Loops
知识点:whilewhile循环,只要条件为真,就会一直循环下去。反复记忆:条件真,循环。我们用while循环就要注意,要设置一个“终点”,让条件变假,循环终止。不然就会形成死循环。为避免这种情况,有些规则我们要遵守:能用 for 就不用 while检查while语句,确保在某一时刻条件会变 False在while循环开始和结尾处都加个断点,如print一些变量,看看循环做了什么i ...原创 2019-02-14 09:25:32 · 163 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 47 Automated Testing
1原创 2019-03-05 10:00:24 · 272 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 50 Your First Website
1原创 2019-03-05 11:15:46 · 200 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 43 Basic Object-Oriented Analysis and Design
1原创 2019-03-02 12:34:42 · 254 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 44 Inheritance versus Composition
1原创 2019-03-02 15:36:40 · 256 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 45 You Make a Game
1原创 2019-03-04 10:24:14 · 331 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 46 A Project Skeleton
1原创 2019-03-04 11:35:46 · 233 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 17 More Files
建议ex15-17连起来练习原创 2019-01-31 15:51:15 · 282 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 2 Comments and Pound Characters
注释的使用 # 符号后面的所有字符python都不会运行# A comment, this is so you can read your program later.# Anything after the # is ignored by python.print("I could have code like this.") # and the comment after i...原创 2018-12-29 12:11:32 · 280 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 3 Numbers and Math
说给初学者的话:programmers frequently lie about being math geniuses when they really aren’t. If they were math geniuses, they would be doing math, not writing buggy web frameworks so they can drive race cars...原创 2019-01-07 15:23:40 · 260 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 4 Variables and Names
我们已经能用 print 输出点东西和做点计算,下一步我们要学习变量。在python里,变量就是一个名字,一个标签。开始打代码cars = 100space_in_a_car = 4.0drivers = 30passengers = 90cars_not_driven = cars - driverscars_driven = driverscarpool_capacity ...原创 2019-01-08 10:53:10 · 220 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 8 Printing,Printing
继续print。下面的代码看起来复杂,不懂就注释,理解后,很简单。formatter = "{} {} {} {}"print(formatter.format(1, 2, 3, 4))print(formatter.format("one", "two", "three", &原创 2019-01-14 20:28:49 · 254 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 9 Printing,Printing,Printing
知识点:巩固print里变量的输入和三引号的用法,\n的含义是换行笨方法继续从练习中学习,开始print!# Here's some new strange stuff, remember type it exactly.days = "Mon Tue Wed Thu Fri Sat Sun"months = "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug...原创 2019-01-14 22:01:32 · 265 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 5 More Variables and Printing
输入更多的变量并把他们输出来。学习使用 f "{变量}"my_name = 'Zed A. Shaw'my_age = 35 # not a liemy_height = 74 # inchesmy_weight = 180 # lbsmy_eyes = 'Blue'my_teeth = 'White'my_hair = 'Brown'prin...原创 2019-01-09 14:49:02 · 259 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 6 Strings and Text
之前的练习一直在写字符串(strings),可能你还不知道它们有什么用。现在我们加强练习来弄明白它们是干什么的。首先解释一下:字符串是你想给某人看的信息,或者你想从程序里输出一些东西。只要放在单引号或双引号里通过 print 就能输出来。我们之前使用 f"blahblah{变量}" 把需要的变量放进去。python还有另一个格式: .format(), 我们接下来的练习中会用到。types...原创 2019-01-09 15:48:18 · 212 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 7 More Printing
更多的练习,是为了打好基础。开始吧!不要懒惰!不要复制粘贴!在这节练习,我们复习了 {}.format() 和字符串的“加法”(第20、21行),新接触了字符串的“乘法”(第4行)和第20行的print( i , end=’ ')print("Mary had a little lamb.")print("Its fleece was white as {}".format('snow'))...原创 2019-01-09 19:33:45 · 259 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 15 Reading Files
建议ex15-17连起来练习原创 2019-01-31 13:38:16 · 284 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 16 Reading and Writing Files
建议ex15-17连起来练习原创 2019-01-31 14:38:18 · 312 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 11 Asking Qustions
知识点:print(end=’’)的用法,input的用法经过大量烦躁的练习后,我们现在get data into your programs。大部分的软件做的是以下的事情 :1、让用户输入点什么2、包装一下3、输出包装后的结果print("How old are you?", end=" ")age = input()print(&q原创 2019-01-21 22:38:04 · 229 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 1 A Good First Program
LearningPython3hardway__Exercise 1Type the following text into a single file named ex1.py。print("Hello World!")print(&am原创 2018-12-29 11:13:15 · 473 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 12 Prompting People
知识点:input()的用法input的括号里可以加入提示语告诉人们要输入什么,然后赋值给变量。如:y = input(“Name?”)这样,我们上一个练习就可以用input重新改写age = input("How old are you? ")height = input("How tall are you? ")weight = input(&原创 2019-01-21 22:59:20 · 223 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 18 Names, Varibles, Code, Functions
建议ex18-21连起来学习**知识点:Functions 方法,就是我们经常见到的def **方法三件事:1、给一段代码用字符串和数字命名2、他们需要参数,跟之前我们使用argv获取参数一样3、然后你就拥有了小程序或小命令# this one is like your scripts with argvdef print_two(*args): arg1, arg2 = a...原创 2019-02-01 13:24:16 · 140 阅读 · 0 评论 -
LearnPython3theHardWay__Excercise 10 What Was That?
知识点:转义字符" \ "在上一节练习中,我们输入的字符串要换行用了两种方法。一种是在要换行的地方插入 “\n” ,第二种是用三引号。 接下来这两种方法我们都用上。tabby_cat = "\tI'm tabbed in."persian_cat = "I'm split\non a line."backslash_cat = "I'm \\ a \\ cat.&q原创 2019-01-16 18:56:12 · 170 阅读 · 0 评论
分享