Ryan the Data Guy
Published in

Ryan the Data Guy

Python as a Calculator

5 // 2 = 2 but 4.9 // 2 = 2.0 where 4.9 / 2 = 2.45, so there’s that.
(a) 27 // 8 = 3
(b) 27 % 8 = 3
Take (a) as your whole number and (b) as your numerator giving you (a) (b)/(c) is 3 3/(c) where (c) is your divisor (8) so 3 3/8. How do we know this is correct?27 / 8 = 3.375
3 + (3 / 8) = 3.375
Is it helpful to know this? Probably not, but it’s a nice to know and can make people 'ohh' and 'ahh' if they haven’t already figured it out. So I guess it’s for a slight ego boost.
10 + 9 ** 8 // 6 * 2–26 = xNow exponents: 9 ** 8 = 43046721
10 + 43046721 // 6 * 2–26 = x
Now division and multiplication
[(43046721 // 6) * 2 = 7174453 * 2 = 14348906
10 + 14348906–26 = x
Now addition and subtraction
[(10 + 14348906) — 26] = 14348916–26 = 14348890
So 14348890 = xSimple.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ryan Velasco

I love gaming especially old-school jRPGs, I love them to this day. Now I’ve come to love automating everything and placing things into databases. Super fun.