Skip to content

Joffrey Fouché - fin verif date et début algo#39

Open
joffrey3 wants to merge 4 commits intobcalou:mainfrom
joffrey3:main
Open

Joffrey Fouché - fin verif date et début algo#39
joffrey3 wants to merge 4 commits intobcalou:mainfrom
joffrey3:main

Conversation

@joffrey3
Copy link
Copy Markdown

No description provided.

@joffrey3 joffrey3 marked this pull request as ready for review November 17, 2023 08:34
Copy link
Copy Markdown
Owner

@bcalou bcalou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Des choses à corriger mais c'est bien avec un soin apporté à la clarté. Attention à vérifier pycodestyle

Comment on lines +6 to 16
"""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))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bien

@@ -1,2 +1,96 @@
import doomsday.date as date

WEEK_DAY_STR = ("Sunday", "Monday", "Tuesday", "Wednesday",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eviter la référence au type dans le nom des variable eux-mêmes (str)
Weekday c'est sans espace, petit détail

Comment on lines +6 to +7
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)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pas sûr de la signification de "TAB" ici

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
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +13 to +15
YEAR = 0
MONTH = 1
DAY = 2
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas de majuscule dans le nom d'une fonction

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pas de majuscule

doomsday/date.py Outdated
return MIN_MONTH_LAST_DAY


def get_leap(year: int) -> bool:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_leap (on pose une question)

doomsday/date.py Outdated


def get_leap(year: int) -> bool:
"""change the variable if the year is leap"""
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentaire inexact . "Change" the variable ?


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) %
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention tu dois avoir des erreurs de formattage avec pycodestyle (espacement autour du +)

@bcalou
Copy link
Copy Markdown
Owner

bcalou commented Nov 24, 2023

Beaucoup d'efforts pour avoir un code très clair, félicitations.
On peut toujours améliorer, peut-être alléger certains passages (beaucoup de sous-fonctions, c'est bien mais c'est un équilibre à trouver).
Mais c'est un très bon début pour ces TP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants