-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ex1 #173
Ex1 #173
Conversation
src/ex1.py
Outdated
if week == 1: | ||
day = "Monday" | ||
elif week == 2: | ||
day = "Tuesday" | ||
elif week == 3: | ||
day = "Wednesday" | ||
elif week == 4: | ||
day = "Thursday" | ||
elif week == 5: | ||
day = "Friday" | ||
elif week == 6: | ||
day = "Saturday" | ||
elif week == 7: | ||
day = "Sunday" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invece che usare tutti questi if else, potresti creare un array ordinato di stringhe e accedere direttamente a questo usando come indice il valore intero che la funzione get_week_day riceve in input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L'esercizio originale richiedeva di costruire la funzione con il costrutto switch, ma la cambio comunque
/* Improve this program using a switch-case. */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hai ragione! Colpa mia 😅
Comunque così è molto più carino che con uno switch ahahah
@@ -0,0 +1,12 @@ | |||
from src.ex1 import get_week_day | |||
|
|||
def test_ex1() -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rinomina correttamente il nome delle funzione
Fatto l'esercizio 1 delle settimane e aggiunto file di test