Chapter Eight- Lists

دوره Python Data Structures ، فصل 4 : Chapter Eight- Lists

درباره‌ی این فصل:

As we want to solve more complex problems in Python, we need more powerful variables. Up to now we have been using simple variables to store numbers or strings where we have a single value in a variable. Starting with lists we will store many values in a single variable using an indexing scheme to store, organize, and retrieve different values from within a single variable. We call these multi-valued variables "collections" or "data structures".

این شامل 7 زیر است:

But what you're noticing here is I can put three things, three different strings, Joseph, Glenn, and Sally, into a single variable by enclosing them in this brackets. We can change lists and the word that's used in Python speak is called mutable, means changeable. It's a nice simple determinant loop that basically has an interation variable and it's very clear if all we want to do is print them out.

So note that stuff is different from here to here because we appended it, and that's because lists are mutable, but not strings. They're kind of dense and compacted, and you can only add to the end, although you can say, push all those ones down and put something in the middle using insert, if you like. If you've already got numbers in a list then add them up with a sum or figure out the maximum using a function, that's just perfectly fine.

So the code to make this work is here's my string, split it, and then write a simple for loop that's horizontally going to go through and look at each of the three words in that. So when you tell it to split on a different character, it doesn't do this fancy thing of compressing multiple spaces. So, that gives us sort of a good start on lists, our first real data structure.

And I was checking into my hotel this afternoon and she said, you're in room 14 and you're on the first floor and the elevators are right around the corner. And the problem of course is that floors here start in zero just like strings and lists in Python. Welcoming my Python class from Paris, France.

As a matter of fact, we're going to read you our famous mailbox data, look for lines that begin with From space, and extract the third word. So if we take a look at our dataset, it found the line started with From space, it split it, and it printed out the third word. And so the first thing I like to do in this kind of a situation is find the line and make sure there's a print statement right before it.

Here we are in a basement of Palmer house, Hilton in Chicago, Illinois at yet another office hours for internet history and technology and security. Hi classmates, I"m James from Chicago. We talked about changing the grading, which you'll soon see.

Basically CGI scripts written in C. And I wrote similar code to handle forms, and post data, and filtering. It's kind of tedious and boring, so if I could reduce the amount of time I had to spend programming, and maximize the, the output and get to the solution quicker, that was my goal with PHP. I put together all my common stuff into a C library, hacked it into the NCSA web server, and then added a little templating system on top of that to let me easily call into it.

مشارکت کنندگان در این صفحه

تا کنون فردی در بازسازی این صفحه مشارکت نداشته است.

🖊 شما نیز می‌توانید برای مشارکت در ترجمه‌ی این صفحه یا اصلاح متن انگلیسی، به این لینک مراجعه بفرمایید.