diff --git a/projects/001-area-of-a-room/DinoJasari/solution-area-of-a-room.py b/projects/001-area-of-a-room/DinoJasari/solution-area-of-a-room.py new file mode 100644 index 0000000..86ccfa4 --- /dev/null +++ b/projects/001-area-of-a-room/DinoJasari/solution-area-of-a-room.py @@ -0,0 +1,22 @@ +# Write a program that asks the user to enter the width and length of a room. +# input = lunghezza e larghezza + +# Once these values have been read, your program should compute and display the area of the room. +# output = area della stanza +# +# The length and the width will be entered as **floating-point numbers**. +# input = numero con la virgola (float) +# +# Include units in your prompt and output message; either feet or meters, depending on which +# unit you are more comfortable working with. + + +print("") +print("Questo porgramma calcola l'area di una stanza i metri.") + +larghezza = float(input("Inserire la larghezza della stanza ")) +lunghezza = float(input("Inserire la lunghezza della stanza ")) +area_stanza = larghezza * lunghezza +print("") +print(f"L'area della stanza è {area_stanza:.2f} m*2") +print("") \ No newline at end of file diff --git a/projects/002-bottle-deposits/DinoJasari/bottle-deposits.py b/projects/002-bottle-deposits/DinoJasari/bottle-deposits.py new file mode 100644 index 0000000..c5dd7be --- /dev/null +++ b/projects/002-bottle-deposits/DinoJasari/bottle-deposits.py @@ -0,0 +1,34 @@ +# In many jurisdictions a small deposit is added to drink containers to encourage people to recycle them. + + +# In one particular jurisdiction, drink containers holding one liter or less have a $0.10 deposit, and drink containers holding more than one liter have a $0.25 deposit. +# - meno di 1 litro deposito 0.10$ +# - piu di 1 litro deposito 0.25$ + + +# Write a program that reads the number of containers of each size from the user. +# Il programma calcola la quantità di contenitori e la grandezza + +# Your program should continue by computing and displaying the refund that will be received for returning those containers. +# Il programma calcola e visualizza il rimborso dei contenitori inseriti + + +# Format the output so that it includes a dollar sign and two digits to the right of the decimal point. +# Formato output = 2 cifre dopo , e simbolo $ + + +print ("") +minore_1l = int(input("Inserire le bottiglie di capacità inferiori a un litro ")) +maggiore_1l = int(input("Inserire le bottiglie di capacità maggiori a un litro ")) + +somma_prezzo_bott = ((minore_1l * 0.10) + (maggiore_1l * 0.25)) +totale_bottiglie = (minore_1l) + (maggiore_1l) + +print("") +print("Sono state inserite " + str(minore_1l) + " bottiglie di capacità inferiori a 1l e " + str(maggiore_1l) + " di capacità superiori a 1l") +print("") +print("Totale bottilgie inserite " + str(totale_bottiglie)) +print(f"Totale {somma_prezzo_bott:.2f}$") +print("") + + diff --git a/projects/003-making-change/DinoJasari/making-change.py b/projects/003-making-change/DinoJasari/making-change.py new file mode 100644 index 0000000..1d76358 --- /dev/null +++ b/projects/003-making-change/DinoJasari/making-change.py @@ -0,0 +1,52 @@ +# Consider the software that runs on a self-checkout machine. + +# One task that it must be able to perform is to determine how much change to provide when the shopper +# pays for a purchase with cash. +# calcolare il resto quando si paga in contatni +# +# Write a program that begins by reading a number of cents from the user as an integer. +# input = numero di monete inserite come int +# +# Then your program should compute and display the denominations of the coins that should be used +# to give that amount of change to the shopper. +# output = calcola e visualizza il teglio delle monete che devono essere date come resto + +# **The change should be given using as few coins as possible.** +# usare il meno monete possibili +# +# penny 1 nickel 5 dime 10 quarter = 25 loonie = 100 toonie = 200 + +print("") + +spesa_tot = int(input("Spesa totale ")) +monete_inserite = int(input("Inserire monete ")) +resto = monete_inserite - spesa_tot +print("") + +if resto >= 200: + print(resto // 200, "toonie") +resto = resto % 200 + +if resto >= 100: + print(resto // 100, "loonie") +resto = resto % 100 + +if resto >= 25: + print(resto // 25, "quarter") +resto = resto % 25 + +if resto >= 10: + print(resto // 10, "dime") +resto = resto % 10 + +if resto >= 5: + print(resto // 5, "nickel") +resto = resto % 5 + +if resto >= 1: + print(resto // 1, "penny") +resto = resto % 1 + +print("") + + diff --git a/projects/004-units-of-time/DinoJasari/units-of-time.py b/projects/004-units-of-time/DinoJasari/units-of-time.py new file mode 100644 index 0000000..88ccc50 --- /dev/null +++ b/projects/004-units-of-time/DinoJasari/units-of-time.py @@ -0,0 +1,19 @@ +# Create a program that reads a duration from the user as a number of days, hours, minutes, and seconds. +# input = sequenza di 4 numeri con lo spazio in mezzo + +# Compute and display the total number of seconds represented by this duration. +# restituisci il totale in secondi + +# giorni = 86400 +# ore = 3600 +# minuti = 60 +# secondi = 1 + +print("") +giorni, ore, minuti, secondi = input("Digitare la sequenza di numeri in questo ordine: giorni, ore, minuti e secondi, lasciando uno spazio tra ciascun numero " ).split() + +print("") +totale_secondi = (int(giorni) * 86400) + (int(ore) * 3600) + (int(minuti) * 60) + int(secondi) + +print("La somma espressa in secondi è:" , totale_secondi) +print("") \ No newline at end of file diff --git a/projects/005-units-of-time-again/DinoJasari/units-of-time-again.py b/projects/005-units-of-time-again/DinoJasari/units-of-time-again.py new file mode 100644 index 0000000..f0ddf99 --- /dev/null +++ b/projects/005-units-of-time-again/DinoJasari/units-of-time-again.py @@ -0,0 +1,32 @@ +# In this exercise you will reverse the process described in Exercise 4. + +# Develop a program that begins by reading a number of seconds from the user. +# input = leggere e salvare in una variabile il numero del utente +# +# Then your program should display the equivalent amount of time in the form D:HH:MM:SS, where D, HH, MM, and SS represent days, hours, minutes and seconds respectively. +# output = restituire il dato in formato D:HH:MM:SS (giorni, ore, minuti e secondi) + +# The hours, minutes and seconds should all be formatted so that they occupy exactly two digits. +# Il formato delle ore, min e sec deve occupare 2 spazi/cifre + +# Use your research skills determine what additional character needs to be included in the format specifier +# so that leading zeros are used instead of leading spaces when a number is formatted to a particular width. +# Il formato utlizzato deve uare lo 0 al posto degli spazi quando il numero è a 1 cifra + + +print("") +secondi_tot = int(input("Inserire numero di secondi ")) + +giorni = (secondi_tot // 86400) +secondi_rg = (secondi_tot % 86400) + +ore = (secondi_rg // 3600) +secondi_ro = (secondi_rg % 3600) + +min = (secondi_ro // 60) +secondi = (secondi_ro % 60) + +format = f"{giorni:02}:{ore:02}:{min:02}:{secondi:02}" +print("") +print(format) +print("") diff --git a/projects/006-sum-of-digits-in-a-integer/DinoJasari/sum-of-digits-in-a-integer.py b/projects/006-sum-of-digits-in-a-integer/DinoJasari/sum-of-digits-in-a-integer.py new file mode 100644 index 0000000..6cb23c8 --- /dev/null +++ b/projects/006-sum-of-digits-in-a-integer/DinoJasari/sum-of-digits-in-a-integer.py @@ -0,0 +1,16 @@ +# Develop a program that reads a four-digit integer from the user and displays the sum of its digits. +# input = numero a 4 cifre +# +# For example, if the user enters 3141 then your program should display 3+1+4+1=9. +# output = somma delle 4 cifre + +print("") +num_4c = (input("Inserire numero a 4 cifre ")) +somma = 0 + +for i in num_4c: + somma = somma + int(i) + +print("") +print(somma) +print("") \ No newline at end of file diff --git a/projects/007-day-old-bread/DinoJasari/day-old-brad.py b/projects/007-day-old-bread/DinoJasari/day-old-brad.py new file mode 100644 index 0000000..db236ac --- /dev/null +++ b/projects/007-day-old-bread/DinoJasari/day-old-brad.py @@ -0,0 +1,32 @@ +# A bakery sells loaves of bread for €3.49 each. +# Day old bread is discounted by 60 percent. +# Pane fresco = €3.49 Pane vecchio = 3.49 scontato 60 % +# +# Write a program that begins by reading the number of loaves of day old bread being purchased from the user. +# input = numero di pane vecchio comprato + +# Then your program should display the regular price for the bread, the discount because it is a day old, and the total price. +# output = prezzo intero, quanto è lo sconto e il prezzo totale +# +# Each of these amounts should be displayed on its own line with an appropriate label. +# ogni prezzo su una riga separata + +# All of the values should be displayed using two decimal places, +# and the decimal points in all of the numbers should be aligned when reasonable values are entered by the user. +# format = 3.00€ (2 cifre dopo ,) allineati orizzontalmente + +print("") +print("Prezzo pane fresco €3.49 (al pezzo). Il pane di ieri è scontato del 60% ") +print("") +pezzi_pane = int(input("Inserire il numero di pezzi ")) +print("") + +prezzo_intero = pezzi_pane * 3.49 +sconto = prezzo_intero * 60 / 100 +totale = prezzo_intero - sconto + +print(f"{"Prezzo intero:":<20} {prezzo_intero:.2f}€") +print(f"{"Sconto:":<20} {sconto:.2f}€") +print(f"{"Totale spesa:":<20} {totale:.2f}€") +print("") + diff --git a/projects/008-dog-years/DinoJasari/dog-year.py b/projects/008-dog-years/DinoJasari/dog-year.py new file mode 100644 index 0000000..81d7463 --- /dev/null +++ b/projects/008-dog-years/DinoJasari/dog-year.py @@ -0,0 +1,43 @@ + +# As a result, some people believe that it is better to +# **count each of the first two human years as 10.5 dog years** primi 2 anni umani = 10.5 anni canini +# and then **count each additional human year as 4 dog years.** dopo primi 2 anni umani = 4 anni canini + +# Write a program that implements the conversion from human years to dog years described in the previous paragraph. +# Ensure that your program works correctly for: +# - conversions of less than two human years +# - conversions of two or more human years +# L'algoritmo deve fare la conversione da anni umani a quelli canini +# input: anni umani + +# Your program should display an appropriate error message if the user enters a negative number. +# output: se viene inserito un numero negativo dare errore +# +# output: 48 human years = 205.0 dog year + +print("") +anni_umani = int(input("Inserire gli anni umani da convertire ")) + +if anni_umani > 2: + anni_canini = ((anni_umani - 2) * 4) + 21 + print(anni_umani, "anni umani =", anni_canini, "anni canini") + print("") + +elif anni_umani <= 0: + print("Per favore inserire un numero positivo diverso da 0") + print("") + +else: + anni_umani <= 2 + anni_canini = (anni_umani * 10.5) + if anni_canini == 10.5: + print(anni_umani, "anno umano =", anni_canini, "anni canini") + print("") + else: + print(anni_umani, "anni umani = 21 anni canini") + print("") + + + + +