Python

Lessons

Arithmetic in V3

Today we talk about the rules of arithmetic in Python Version 3. The key detail is when combining two numbers, Python will widen numbers to make sure they are all of the same type. (In Python v3, there are three numeric types: ints, floats and complex numbers.) And division has changed from version 2. Now, division always returns the correct math value as a float. It no longer returns the quotient when you divide two whole numbers. And beware of division by 0!

Today we talk about the rules of arithmetic in Python Version 3. The key detail is when combining two numbers, Python will widen numbers to make sure they are all of the same type. (In Python v3, there are three numeric types: ints, floats and complex numbers.) And division has changed from version 2. Now, division always returns the correct math value as a float. It no longer returns the quotient when you divide two whole numbers. And beware of division by 0!

Course Page

Resources

Python T-Shirt
Soft t-shirt keeps you comfortable when you're putting in hours coding.
Buy
Python Cookbook
A well-written book with hundreds of Python recipes covering everything from text & strings to network programming. This book is always on our desk.
Buy