feat: Initial commit
This commit is contained in:
29
Laboratorio7/esercizio7.py
Normal file
29
Laboratorio7/esercizio7.py
Normal file
@@ -0,0 +1,29 @@
|
||||
def correzione(a):
|
||||
bb = a[0]
|
||||
a[0] = (a[0] + a[1]) / 2
|
||||
|
||||
for i in range(1, len(a)-1):
|
||||
xx = a[i]
|
||||
a[i] = (bb + a[i] + a[i+1])/3
|
||||
bb = xx
|
||||
|
||||
a[len(a)-1] = (bb + a[len(a)-1])/2
|
||||
|
||||
def readInts():
|
||||
ints = []
|
||||
|
||||
while True:
|
||||
num = input("Inserisci un numero: ")
|
||||
if num == "":
|
||||
break
|
||||
|
||||
ints.append(int(num))
|
||||
|
||||
return ints
|
||||
|
||||
def main():
|
||||
a = readInts()
|
||||
correzione(a)
|
||||
print(a)
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user