2022-10-19 08:47:23 +00:00
|
|
|
# Read numbers until a sentinel (an empty string), and return their sum.
|
|
|
|
# JMR 2018
|
|
|
|
|
|
|
|
|
|
|
|
def inputTotal():
|
2023-05-16 20:14:36 +00:00
|
|
|
"""Read numbers until empty string is entered and return the sum."""
|
|
|
|
tot = 0.0
|
|
|
|
while True:
|
|
|
|
n = input("valor? ") # input("valor? ")
|
|
|
|
if n == '': return tot
|
|
|
|
tot += float(n)
|
2022-10-19 08:47:23 +00:00
|
|
|
|
|
|
|
# MAIN PROGRAM
|
|
|
|
def main():
|
2023-05-16 20:14:36 +00:00
|
|
|
tot = inputTotal()
|
|
|
|
print(tot)
|
2022-10-19 08:47:23 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-05-16 20:14:36 +00:00
|
|
|
main()
|