From 5624cc870db626f1aaa6508f6ae247f5678b076f Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 11 Jul 2019 19:29:08 +0200 Subject: [PATCH] Slight improvements --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index ffcb433..1f086db 100644 --- a/main.py +++ b/main.py @@ -22,7 +22,7 @@ class InseeData: city = insee_number[8:10] self.foreign = False - if department == "99": + if department in ["91", "92", "93", "94", "95", "96", "99"]: self.foreign = True self._country = city else: @@ -79,11 +79,12 @@ class InseeData: return self._department def __str__(self): - message = [] + message = [self.insee_number] + if self.is_valid: - message.append("The number is valid") + message.append("The number is valid.") else: - message.append("The number is invalid") + message.append("The number is invalid.") message.append( f"You're a {self.gender}, born in {calendar.month_name[self.month]}, probably in {self.year}." @@ -122,6 +123,7 @@ class InseeData: def to_dict(self): data = { + "insee_number": self.insee_number, "is_valid": self.is_valid, "gender": self.gender_short, "month": self.month,