Viewers: in countries Watching now:
Due to its power, simplicity, and complete object model, Python has become the scripting language of choice for many large organizations, including Google, Yahoo, and IBM. In Python 3 Essential Training, Bill Weinman demonstrates how to use Python 3 to create well-designed scripts and maintain existing projects. This course covers the basics of the language syntax and usage, as well as advanced features such as objects, generators, and exceptions. Example projects include a normalized database interface and a complete working CRUD application. Exercise files accompany the course.
In this chapter, as we look at operators in Python, we are going to be using the Python Shell which is called Idle in a graphical environment, or in a text environment, it's simply the Python Interpreter, run from the command line. Python has all of the standard arithmetic operators. For example, if you say 5 + 5, you get 10. If say 5 * 5, you get 25. If you say 5 - 3, you get 2, and if you say 5 / 3, you get this 1.666.
Python also has some thing that they call floor division, which is simply integer division. If I say 5 with two slashes divide by three then I get 1, which, of course, has a remainder as well. So if I say 5 with a percent sign from modulo and a 3, then I get the remainder. Python also has a built-in function called divmod that gives the two results together. So if we say Divmod(5, 3), then you get both of those results together as a tuple.
Finally, Python has increment and decrement operators, and they are not quite the same as you see in some other scripting languages. If I say num = 5 and I say num += 1, then look at the value of num; we get 6. If I Say, num -= 1 and we look at the value of num, then we get 5. There is also a multiplication and division form of these. So If I say num *= 5, I get 25.
If I say num floor division equals 5, then I get the integer 5. Of course if I say num *= 5 again and then num with one slash /=5, then we get the floating point version 5.0. So those were the basic arithmetic operators that are available in Python. It has all the standard ones, and a couple that it's implemented in its own interesting way.
Find answers to the most frequently asked questions about Python 3 Essential Training .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.