Skip to Content
Learn Robotics Programming
book

Learn Robotics Programming

by Danny Staple
November 2018
Beginner
472 pages
13h 5m
English
Packt Publishing
Content preview from Learn Robotics Programming

Integer division

In Python 2, using the single slash (/) division operator results in integers even if the result is non integer, by rounding them. In Python 3, this is not the case. Since we are talking about hardware, most hardware is being sent bytes of data that must be in integer form. So, in places where we were relying on that integer division the code could be made explicit with the double slash (//) operator, or better yet converting values to integers with int(<some result>) where that is needed.

Using int(<some result>) around an operation is compatible with both Python 2 and Python 3.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming - Second Edition

Learn Robotics Programming - Second Edition

Danny Staple

Publisher Resources

ISBN: 9781789340747Supplemental Content