ArgC How many words were typed at the prompt, by default, Arg C, should always be at least one.
提示符那里默认要输入多少单词,至少需要一个单词。
And so this, in fact, when you say your computer stores information as zeros and ones, A you've just typed the capital letter A, that's all that's going on inside.
事实上,当你说电脑以这些0与1进行信息存储时,你已经键入了大写字母,那就是在计算机内部发生的过程。
Nonetheless, I'm also going to argue that it's probably not as strongly typed as we might like.
尽管如此,我还是要说,它可能还没有我们想象的,那么强。
And I typed out an email that said, "I'm at Golden Gate Park watching the bison."
我写出了一封邮件说,我在金门公园看野牛“
You have this standardized form and you've got carbon paper between them and you typed it-- all these really created much more accurate techniques.
你在印有这种标准表格的,纸中间夹上复写纸,接着打印信息-,这些都能使得信息更为准确。
The next I knew, she had literally typed my password.
然后她就真的帮我输入了"密码"
Its name is malloc for memory allocation and what malloc does for us is we say, hmm, the user has typed in a three-letter word.
它为我们分配内存地址,它为用户输入的3个字母单词,分配地址。
That is the address in memory in the heap of the first byte that the user typed in.
那是用户输入的字符串第一个字节,内存中堆的地址。
But the string, the sentence or the words that we're displaying on the screen, previously you clicked on a little white text field and typed it in, well now you're gonna do the same thing at the keyboard but you're gonna have to sandwich it in between double quotation marks.
这些你想输出到屏幕上的字符串啊,语句啊,单词啊,或者你事先,在白色输入框中敲进去的内容,现在你们需要用键盘做同样的事情,但是你们要写在,双引号之间。
And notice, by the way, when I typed it how print showed up in a different color?
注意,顺便说一下,当我输入的时候,怎样才能显示不同的颜色呢?
Let's assume that the user typed in a pretty short word we didn't run out of memory or anything crazy so here's the new feature.
假设用户输入,很短的单词,没有出现超出内存之类的问题,这里是新的特点。
s1 We're assigning to s1 the string that the user typed in.
我们把用户输入的字符串赋值给。
All the supreme court justices would share our social values. And most importantly, our programs would work the first time we typed them. By now you may have noticed that we do not live in an ideal world.
符合我们的社会价值观,但是最重要的是,我们写好的程序,第一次就能顺利运行,如今你可能已经注意到了,我们生活的并不是一个理想的世界。
And to do this, I'm going to use some code that I've already typed in.
为了达到这个目的,我会去使用一些,我已经写好的代码。
So when I type, I'm sorry, I shouldn't say type, c point although I would have typed it, p dot x, here's what basically happens.
处于特定点的实例的这个概念,我知道它来自于这个类,这个类,when,I,write,因此当我输入,抱歉,我不该说输入的,当我写,虽然我需要输入它,p,x的时候。
Which is, and we're going to do some examples of this, initially we just typed in expressions Python into the interpreter; that is,directly into Python And as I suggested last time, the interpreter is actually a program inside of the machine that is basically following the rules we're describing here to deduce the value and print it up.
也就是,我们将会对这一点讲解一些例子,一开始我们只是简单的把表达式输入,到解释器里面去,也就是直接传给,我上次跟大家讲过,解释器实际上是,机器内置的,按照我们描述的规则,来推算出结果值并把值显示出来的一个东西。
In this case, I'm going to get back the answer 3 F-O-O because the user typed in F-O-O, but wait a minute, what's with this?
假若这样,我得到了答案3,因为用户输入了,等一下,用这个干吗?
Well, obviously not so you're always going to say you typed different things.
好的,显然不是,你总是会说,你输入了不同的东西。
So STR, which I just typed up there, takes in parens, some input, and it converts it into a string, so that now I can use that John where I was expecting a string. John.
因此STR,也就是,我刚刚输入的,然后把这个输入变更为一个字符串,因此现在我就能,在需要用字符串的地方使用这个对象了。
Well, get string again is returning the address of the string the user typed in, D the address of the very first character like the letter D and storing that address in this variable s1.
好的,GetString返回的是,用户输入的字符串的地址,第一个字符的地址,比如字母,然后把这个地址存储在这个变量s1中。
s2 So, I'm passing in the first character in s2, I'm making it uppercase and then I'm putting it back so casually speaking this is just capitalizing the first letter of whatever word the user typed in to s2.
那么,我把第一个字符传递给,我把它转换成大写的,然后存下来,简单说,这就是把用户输入s2中的单词,的第一个字母转换成大写的。
I store in s1 the address of the first byte that the user typed in and by the way that first bite happens to live in this new place called the heap and that's the only update to the story thus far.
我在s1中存储的是用户输入的字符串的首地址,这样第一个字节存储在这块,新的堆的地方,这个是唯一的修正。
I love Lisp, but Lisp is certainly in the category of a very weakly typed language.
我爱Lisp,但是Lisp当然,是属于在类型检查比较弱的语言一类。
This is what you typed into the white box in Scratch and anyone perhaps already familiar, the backslash N is the shorthand way of saying what?
这也是你们在Scratch的白色输入框里要填入的东西,也许已经有人知道,反斜杠n代表某种简写方式吧?
F-O-O in lowercase and, in fact, foo it is buggy because I typed lowercase F-O-O and FOO yet I get back capital F-O-O as both the original and the copy and that's simply because I haven't done this correctly.
小写的f-o-o,实际上,它是有bug的,因为我输入小写的,而我得到的原始的和拷贝的都是大写的,简单说,我处理错了。
So Arg V bracket I, gives me the Ife string that I typed in.
那么Argv,把我刚键入的字符串Ife传给我。
And if you've typed in l when you should've 1 typed a 1, or a 1 when you should've typed an l, you're likely to miss it. If you've made a mistake with upper and lower case. Things like that. So just be very careful looking at that.
如果你本来想打,1,的时候,却输成了,l,或者打,l,的时候输成了,你很可能注意不到这个错误,如果你把大小写弄混了也是一样,要注意这个错误。
And here's a little trick -- and again, we promised to point -- out little tricks of the trade -- if I know I want to execute the last command I typed that started with an m, bangm will actually figure out what that command was and redo it for me so I don't have to figure it out, or you can go back in time in a terminal window.
这里有个小技巧--此外,我们许诺指出行业中的,一些小技巧-,如果我知道我想执行我写入的上一个命令,是以m开头的,!m会明白那个命令是什么,然后为我恢复上次操作,所以我不需要明白它,或者你可以回到,那个终端窗口。
-- Else if n is greater than 4 and n is less than 6 -- 7 let's call it medium -- else if n is greater than or equal to 7, -- less than or equal to 10 -- let's call it "big" -- and if the user typed in zero or negative 10 or 20 or whatever, let's just use the all-inclusive else block and just say, "You picked an invalid number."
否则如果n大于4,并且n小于-,我们叫它为中间数--否则如果n大于等于,小于等于10--我们叫它为“大数“,如果用户键入了0或者-10或20或其它的,让我们用一个广泛的else子句,只需要说,“你选了一个非法的数字“
应用推荐