Joffrey Fouché - fin verif date et début algo#39
Joffrey Fouché - fin verif date et début algo#39joffrey3 wants to merge 4 commits intobcalou:mainfrom
Conversation
bcalou
left a comment
There was a problem hiding this comment.
Des choses à corriger mais c'est bien avec un soin apporté à la clarté. Attention à vérifier pycodestyle
| """main function ask a date, if the date is incorrect ask again, | ||
| when the date is correct, | ||
| main function ask for the day of the date and return it to the user""" | ||
|
|
||
| while True: | ||
| input_date: str = input( | ||
| "Please enter a date if you want to know it day on week") | ||
| if (date.is_valid_date(input_date)): | ||
| break | ||
| print(input_date + " is a " + algorithm.get_weekday_for_date(input_date)) | ||
|
|
doomsday/algorithm.py
Outdated
| @@ -1,2 +1,96 @@ | |||
| import doomsday.date as date | |||
|
|
|||
| WEEK_DAY_STR = ("Sunday", "Monday", "Tuesday", "Wednesday", | |||
There was a problem hiding this comment.
Eviter la référence au type dans le nom des variable eux-mêmes (str)
Weekday c'est sans espace, petit détail
doomsday/algorithm.py
Outdated
| TAB_CHANGE_FOR_CENTURY = (2, 0, 5, 3) | ||
| TAB_ANCHOR_DAY_IN_MONTH = (10, 21, 0, 4, 9, 6, 11, 8, 5, 10, 7, 12) |
There was a problem hiding this comment.
Pas sûr de la signification de "TAB" ici
doomsday/algorithm.py
Outdated
| TAB_CHANGE_FOR_CENTURY = (2, 0, 5, 3) | ||
| TAB_ANCHOR_DAY_IN_MONTH = (10, 21, 0, 4, 9, 6, 11, 8, 5, 10, 7, 12) | ||
|
|
||
| NUMBER_ADD_IF_ODD = 11 |
There was a problem hiding this comment.
Très bien les constantes jusqu'ici, attention cela dit elles ne se valent pas toutes. Ce 11 est très spécifique, très local. Il peut être déclaré juste là où on en a besoin.
Le haut du fichier est plus adapté aux constantes très générales
doomsday/algorithm.py
Outdated
| YEAR = 0 | ||
| MONTH = 1 | ||
| DAY = 2 |
There was a problem hiding this comment.
Pas mal pour fluidifier la suite en effet
doomsday/date.py
Outdated
| return True | ||
|
|
||
|
|
||
| def List_of_possible_error(error_code: int, error_text: str) -> bool: |
There was a problem hiding this comment.
pas de majuscule dans le nom d'une fonction
There was a problem hiding this comment.
Et c'est une fonction qui fait une action, donc à renommer, ce n'est pas juste une liste
doomsday/date.py
Outdated
| return False | ||
|
|
||
|
|
||
| def Month_last_day(month_number: int, year: int) -> int: |
doomsday/date.py
Outdated
| return MIN_MONTH_LAST_DAY | ||
|
|
||
|
|
||
| def get_leap(year: int) -> bool: |
doomsday/date.py
Outdated
|
|
||
|
|
||
| def get_leap(year: int) -> bool: | ||
| """change the variable if the year is leap""" |
There was a problem hiding this comment.
Commentaire inexact . "Change" the variable ?
doomsday/algorithm.py
Outdated
|
|
||
| def add_century_step(number: int, century: int) -> int: | ||
| """we add a number different with the century""" | ||
| return number+TAB_CHANGE_FOR_CENTURY[(century // CENTURY) % |
There was a problem hiding this comment.
Attention tu dois avoir des erreurs de formattage avec pycodestyle (espacement autour du +)
|
Beaucoup d'efforts pour avoir un code très clair, félicitations. |
No description provided.