feat: Initial commit
This commit is contained in:
19
Laboratorio7/esercizio2.py
Normal file
19
Laboratorio7/esercizio2.py
Normal file
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user