Otherwise I'm going to check to see is the first and last, there's that - 1 indexing, is the first and last element of the string the same?
是第一个还是最后一个,这就是这边-1的索引内容,这个字符串的第一个,和最后一个的内容是否相同呢?
We've looked so far really at two non-scalar types. And those were tuples written with parentheses, and strings.
关于这两种基本类型我们已经,学的相当多了,包括哪些元组和字符串类型。
Somewhere in memory, back to back to back or all of the strings and with them can we store actual words and phrases.
在内存某处,紧邻的或者所有的字符串,我们用它们可以存储实际的单词,和短语。
And we're going to start with one that you many of you, have already bumped into perhaps by accident, which are lists.
曾经遇到过的,可能是偶然遇到的类型来开始,就是数组,数组和字符串类型。
STUDENT: Good question. Sounds like a reasonable guess How in the world am I going to compare a string to a number?
学生:不可闻的声音:,很好的问题,听起来像一个很合理的猜测,我到底该怎么对一个字符串,和一个数字进行比较呢?
If you give me a number and a string, I'm going to concatenate them together, it's really different operations, but nonetheless, it's what it's going to do.
如果给的输入是一个数字和一个字符串,我将会把它们连接在一起,这实在是不正确的操作,但是无论如何,它就是会去这么做。
As we saw before, it simply concatenates them together and gives me back a longer string.
和我们之前学过的一样,这个操作会把两个字符串连接起来。
And this is a place where it's comparing strings and numbers in a strange way.
这里其实是对字符串和数字,以一种相当奇怪的方式进行比较的。
There's a whole bunch of blocks that we'll look at in more fun detail on Friday but I'm going to pick the easiest one here and I'm going to type Hello CS50 in this string, "Hello CS50", zooming in say how nice the puzzle pieces are nicely interlocked?
今天我们看到的各种图块,到下周五我会仔细讲解其中的精妙之处,但今天我只想举一个最简单的例子,我要在这儿键入字符串,放大窗口,然后看看这漂亮的图形和文字,是如何美妙地连结在一起的?
Numbers and strings.
数字和字符串。
The word string is just a synonym for what?
单词和字符串一定程度上是同义词?
We've got values, numbers and strings.
我们讲到了值,数字和字符串。
And it treats it as a string, it's simply getting me back 52*7 the value of that string, 52 times 7, rather than the value of it.
这让Python把它当做字符串来对待,他返回给我了,一个字符串的值,而不是这个数的和。
Again if I go back here, let me comment this out.
一对字符串,s1和s3,让我们运行下他们。
And in this context, the length of that array is stored in Arg C. Well, let's take a look at a slight variance of this that reveals further what we can do and reveals what a string really is.
关于这点,那个数组的长度被存储在ArgC中,好的,让我们看看这个轻微的变化,那个揭示了我们可以做的,和字符串实际上是什么。
应用推荐