Video: PythonNext let's talk a little bit about Python. This is a language that's often mentioned in the same breath as Ruby as it's a very clean and concise object oriented language. We're beginning to see a pattern here it's another language that comes with a really large library. In fact, that's one of the benefits of this language. There is a whole bunch of prewritten functionality we can just type into. Again, like Ruby it is an interpreted language. It's garbage collected. We don't have to worry about compilers. We don't have to worry about memory management.
- Where to go from here
Viewers: in countries Watching now:
Finally, the course compares how code is written in several different languages, the libraries and frameworks that have grown around them, and the reasons to choose each one.
- Writing source code
- Understanding compiled and interpreted languages
- Requesting input
- Working with numbers, characters, strings, and operators
- Writing conditional code
- Making the code modular
- Writing loops
- Finding patterns in strings
- Working with arrays and collections
- Adopting a programming style
- Reading and writing to various locations
- Managing memory usage
- Learning about other languages
Next let's talk a little bit about Python. This is a language that's often mentioned in the same breath as Ruby as it's a very clean and concise object oriented language. We're beginning to see a pattern here it's another language that comes with a really large library. In fact, that's one of the benefits of this language. There is a whole bunch of prewritten functionality we can just type into. Again, like Ruby it is an interpreted language. It's garbage collected. We don't have to worry about compilers. We don't have to worry about memory management.
And although, it's really powerful it's a very easy language to get started with. So what it is used for? Well, one of the great things about Python is totally cross-platform. There are Python interpreters on every platform that are well supported. It's a very easy language to build web applications with and ties in particular well with the Apache web server, but you'll also see it being used a lot as an embedded scripting language inside other applications. And it's used a great deal for building applications and web apps by companies like Google and Yahoo! So we want to know what does it look like.
Well, again it's one of these programs where we could have an entire valid program in one statement like with Ruby. We don't need a section called main. We don't need the semicolons. This is perfectly acceptable. But it doesn't teach us a lot. So let me add a few more lines. I can see that like Ruby we use the pound sign and hash mark as a comment and we use def for a define for describing a function, but here's an interesting thing. I'm defining a function here called sayhello that takes one parameter of name.
The question is where does it end? Well, Python is interesting, because it is one of the languages that does pay attention to indentation. We don't use the curly brace to mark the end of a function; we just indent the lines that are inside the function. So in this case, it's just one line. It says print 'hello' and follows it with the name parameter. So then down below this I can just call this function. Python knows the function has ended, because there are no more indented lines. Now that looks a little different, if you're used to either the word end or you're used to those curly braces, but it's leads to a very clean readable syntax.
Unlike Ruby, this is a very concise readable language that's easy to get started with. So how would we get started? Well, there are several IDEs and editors that support Python. Two common ones would be the Eclipse IDE with the extension PyDev that helps for Python development and Komodo as well. Although you'll find many programmers' text editors will support Python. Python interpreters are available on every platform and actually built into recent additions of Mac OS X, but the single best resource for getting started would be the website python.org.
This is the official Python website and has a great amount of installers, help, and tutorials for how to get moving with this language.
Find answers to the most frequently asked questions about Foundations of Programming: Fundamentals .
Here are the FAQs that matched your search "" :
- Q: Using TextEdit with Mac OS 10.9 Mavericks?
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.