Skip to content
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

Closed
wants to merge 7 commits into from
Closed

Ex1 #173

wants to merge 7 commits into from

Conversation

simone-cartalemi
Copy link

Fatto l'esercizio 1 delle settimane e aggiunto file di test

src/ex1.py Outdated Show resolved Hide resolved
src/ex1.py Outdated
Comment on lines 5 to 18
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"
Copy link
Collaborator

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

Copy link
Author

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. */

Copy link
Collaborator

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

src/ex1.py Outdated Show resolved Hide resolved
src/ex1.py Outdated Show resolved Hide resolved
@@ -0,0 +1,12 @@
from src.ex1 import get_week_day

def test_ex1() -> None:

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

@simone-cartalemi simone-cartalemi closed this by deleting the head repository Nov 28, 2023
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.

4 participants