Edmonton Python User Group

When standing as a group of people, always leave room for 1 person to join your group.

The Pac-Man Rule

Jobs

Local

Online

Looking for a job? Looking to hire great people?

Please visit #opportunities at devedmonton.slack.com

Events

Python Pizza
April 25th @ 2:00AM MDT, Online


PyCon US 2020

April - May, Online

News

Articles

Python Tip

# Floating point arithmetic
print(0.1 + 0.1 + 0.1 == 0.1 * 3)  # True

# Alright, how about these?
print(0.1 + 0.1 + 0.1 == 0.3)  # False
print(0.1 * 3 == 0.3)          # False

# For exact decimal arithmetic, we use the decimal module
# and Decimal class
from decimal import Decimal

one_tenth = Decimal("0.1")  # For brevity's sake

# All 3 return True
print(one_tenth + one_tenth + one_tenth == one_tenth * 3)
print(one_tenth + one_tenth + one_tenth == Decimal("0.3"))
print(one_tenth * 3 == Decimal("0.3"))

# But you can't mix Decimal and floating point!
print(Decimal("24.99") * 1.05)
# TypeError: unsupported operand type(s) for *: 
# 'decimal.Decimal' and 'float'

Floating Point vs Decimal

Next Meetup

May...be?

(We're going to try to make it happen, 🤞)

🤷‍♀️🤷‍♂️

Today's Talks!

Solving Moral Philosophy Forever using FastAI, Reddit and Python

Paul Duerr


Building Crappy Jeopardy with Django Channels

Daniel Mouris

Made with Slides.com