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 = 3Take (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.3753 + (3 / 8) = 3.375Is 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 = 4304672110 + 43046721 // 6 * 2–26 = xNow division and multiplication[(43046721 // 6) * 2 = 7174453 * 2 = 1434890610 + 14348906–26 = xNow addition and subtraction[(10 + 14348906) — 26] = 14348916–26 = 14348890So 14348890 = xSimple.`

--

--

## More from Ryan the Data Guy

Hi, I’m Ryan from Canada learning what I need to know in order to become a Data Engineer. The fails and successes as well as fun/neat things I’ve learned on the way.

## Get the Medium app

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.