diff --git a/src/ex1.py b/src/ex1.py index 0069a9ab..4fd9dd26 100644 --- a/src/ex1.py +++ b/src/ex1.py @@ -47,3 +47,4 @@ # # return 0; # } +week = input("Enter week number: ") diff --git a/src/ex2.py b/src/ex2.py index 2ce418ef..5cfa6596 100644 --- a/src/ex2.py +++ b/src/ex2.py @@ -49,3 +49,10 @@ # # return 0; # } + +week = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"] +while True: + week_input = int(input("inserire giorno: ")) + if week_input>=0 and week_input<=7: + break +print("hai selezionato: ", week[week_input]) \ No newline at end of file diff --git a/src/ex3.py b/src/ex3.py index 74592df6..367119b3 100644 --- a/src/ex3.py +++ b/src/ex3.py @@ -7,37 +7,47 @@ # { # string textInput; # -# cout << "Enter a famous name+surname, ex. BarackObama " << endl; +# cout << "Enter a famous name+surname, ex. BarackObama ") # cin >> textInput; # # if (textInput == "BarackObama") -# { -# cout << "44th president of the United States" << endl; -# } -# else if (textInput == "SandroPertini") -# { -# cout << "Former President of the Italian Republic" << endl; -# } -# else if (textInput == "NelsonMandela") -# { -# cout << "Former President of South Africa" << endl; -# } -# else if (textInput == "MahatmaGandhi") -# { -# cout << "Bapu" << endl; -# } -# else if (textInput == "DonaldKnuth") -# { -# cout << "Creator of LaTeX" << endl; -# } -# else if (textInput == "DennisRitchie") -# { -# cout << "Creator of C" << endl; -# } -# else -# { -# cout << "Invalid input! Please enter a good name!" << endl; -# } -# +# # print(44th president of the United States") +# # if (textInput == "SandroPertini") +# # print(Former President of the Italian Republic") +# # if (textInput == "NelsonMandela") +# # print(Former President of South Africa") +# # if (textInput == "MahatmaGandhi") +# # print(Bapu") +# # if (textInput == "DonaldKnuth") +# # print(Creator of LaTeX") +# # if (textInput == "DennisRitchie") +# # print(Creator of C") +# # else +# # print(Invalid input! Please enter a good name!") +# # # return 0; # } + +good = False +textInput = input("Enter a famous name+surname, ex. BarackObama ") +if textInput == "BarackObama": + print("44th president of the United States") + good = True +if textInput == "SandroPertini": + print("Former President of the Italian Republic") + good = True +if textInput == "NelsonMandela": + print("Former President of South Africa") + good = True +if textInput == "MahatmaGandhi": + print("Bapu") + good = True +if textInput == "DonaldKnuth": + print("Creator of LaTeX") + good = True +if textInput == "DennisRitchie": + print("Creator of C") + good = True + +if good == False: + print("Invalid input! Please enter a good name!") \ No newline at end of file