Chapter Four- Functions

دوره Programming for Everybody (Getting Started with Python) ، فصل 6 : Chapter Four- Functions

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

This is a relatively short chapter. We will learn about what functions are and how we can use them. The programs in the first chapters of the book are not large enough to require us to develop functions, but as the book moves into more and more complex programs, functions will be an essential way for us to make sense of our code.

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

def is the keyword, it ends in a colon, just like lots of things that start an indented block. And then it does what is called a return and it gives us back the thing that it's like, you asked me to find this and now I found a w. Here you go and then that w gets assigned into big. And if we do something crazy like add 1 to it, Boom, we get a traceback because we can't concatenate string and integer just cause they're the wrong type.

And the result is, is you have extended Python to have this thing called the print_lyrics function, and it's got two bits of code in here. That little bit inside the block is the function, that stuff's been copied up to there, and now it continues on and it prints Yo. So it sort of pauses here and then it runs this code and then the return says, oh, this little bit that was the function, send that back right there.

I got immediately started getting useful positive feedback from, well initially just from random people who picked up free software from Usenet. Then came the invitation to come to the United States for a couple of months from NIST, the National Institute for Standards and Technology. Through that Python workshop I met people who offered me a job and from '95, I mean I went back to the Netherlands for a few months and then from '95 to 2000 I worked in US in northern Virginia at CNRI.

Hello, this is Charles Severence, I'm coming to you from Manila, Philippines, at a Starbucks, at Robinson's Place, at office hours here on the 26th of November, 2012, in Manila. Yet another successful Internet History Technology and Security Coursera office hours. I think the next place that we're gonna be meeting is Paris, at the end of January.

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

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

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