Saturday, January 14, 2017

Binary to Base 10 with Python

Python has a unique syntax for exponents:   Instead of the standard 3^2 representing 3 to the second power, Python uses 3**2.  It makes sense.  I guess.  In a weird sort of way.  Of course, if no one told you, you might spend a while troubleshooting your code thinking the only thing that couldn't POSSIBLY be wrong is 3^2=9.  But....in the python world, 3**2 is 9.

The code for Binary to Base 10 in Python was a little more straightforward than Scratch.


No comments:

Post a Comment