- 博客(11)
- 收藏
- 关注
原创 learn python the hard way (personal) -- Ex38-
learn python the hard way -personal -- Ex38-Ex 38appendlistStudy DrillsEx39DictionariesEx 38append首先回忆一下之前学过的append,在Ex32中,我们使用过append,但还不清楚它的原理,接下来将详细说明。以mystuff.append(‘hello’)为例1.首先python会回溯你创...
2018-11-19 17:22:29
169
原创 learn python the hard way (personal) -- Ex34-
Ex34:有序数列的顺序,从0开始。 Ex35:这部分代码很多,类似于之前的ex14的zork游戏。需要注意 while True 和 exit(0)while True: choice = input(">") if choice == "take honey": dead("The bear looks at...
2018-10-08 22:11:22
135
原创 learn python the hard way (personal) -- Ex27-
Ex27:一系列逻辑练习,类似于离散数学中的逻辑部分,所以跳过。 Ex28:仍然是逻辑练习部分 Ex29:if语句people = 20cats = 30dogs = 15if people < cats: print("Too many cats! The world is doomed!") Ex30:if-else语句:...
2018-09-30 10:38:49
188
原创 learn python the hard way (personal) -- Ex23-
Ex23:讲解了计算机的encode 和 decode原理。ASCII only encode English and a few other similar languages. Different contries using different languages ,so people create Unicode to solve the problem. The conventi...
2018-09-27 16:51:02
307
原创 learn python the hard way (personal) -- Ex18-
Ex18:Introducing the functionStudy DrillsCreate a function checklist for later exercises. Write these checks on an index card and keep it by you while you complete the rest of these exercises or...
2018-09-11 09:42:57
121
原创 learn python the hard way (personal) -- Ex11-
Ex11:input()接收一个python表达式作为输入,并将运算结果返回。like = input('Do you like me?')print("You say:", like)如果要别人输入int: x = int(input())如果你希望将输出的值转成字符串,可以使用 repr() 或 str() 函数来实现。age = input()print("...
2018-09-08 13:09:45
204
原创 learn python the hard way (personal) -- Ex4-
Ex4:注意浮点数的使用Ex5:1.变量名必须以字母开头; 2.如下所示变量在print时,注意加 f 和 {}my_name = 'Lynn'print(f"Let's talk about {my_name}.")3.round() 返回浮点数的四舍五入值Ex6:变量赋值字符串的几种形式:1.直接赋值为字符串binary = "binary"...
2018-09-04 09:45:17
156
原创 learn python the hard way (personal) -- Ex3
1.在整数除法中,除法(/)总是返回一个浮点数,如果只想得到整数的结果,丢弃可能的分数部分,可以使用运算符 //
2018-02-26 08:42:00
119
原创 learn python the hard way (personal) -- Ex2
1.The # character is called (octothorpe or pound character).2.# inside a string not get ignored.3.Reading code backward is a trick to catch errors and a handy-error checking technique.
2018-02-26 08:29:39
146
原创 learn python the hard way (personal) -- Ex0
1.Learn how to make a directory in the PowerShell (Terminal).2.Learn how to change into a directory in the PowerShell (Terminal).cd : change directory
2017-12-10 14:04:09
224
原创 learn python the hard way (personal) -- Ex1
For this exercise, try these things:1.Make your script print another line.print(‘’)notice:Python是自动换行,若要将内容执行在同一行,在行尾输入end="" ex: print('a',end="") print
2017-12-10 13:49:23
254
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人