19 lines
234 B
Python
19 lines
234 B
Python
su = 0
|
|
op = True
|
|
|
|
while True:
|
|
inp = input("Inserisci un numero: ")
|
|
|
|
if inp == "":
|
|
break
|
|
|
|
inp = int(inp)
|
|
|
|
if op:
|
|
su += inp
|
|
else:
|
|
su -= inp
|
|
|
|
op = not op
|
|
|
|
print("La somma alternata è", su) |