# This program adds numbers from a URL # and reports the sum of all the numbers. # This version uses a bad URL to raise an error. import urllib.request def main(): URL = "http://buildingpythonprograms.com/input/numbers.dat" sum = 0.0 with urllib.request.urlopen(URL) as url: for n in url.read().split(): sum += float(n) print("Sum is:", round(sum, 1)) main()