python - Python3 Adding sum of list -
i stuck trying sum of lists. keep getting error int , can't sum. need convert lists else?
edit: added inputs beginning clarity.
sqft = int(input('input paint coverage in sq ft per gallon: ' )) wall = int(input('input number of walls: ')) window = int(input('input number of windows: ')) door = int(input('input number of doors: ')) wall1=[] # wall list lengths wall2=[] # wall list widths win1=[] # window list lengths win2=[] # window list widths d1=[] # door list lengths d2=[] # door list widths x in range(1, (wall) +1): print('input length of wall ', x, ':') = [int(x) x in input().split(',')] wall1.append(a) print('input width of wall ', x, ':') b = [int(x) x in input().split(',')] wall2.append(b) print(wall2, ':', wall1) x in range(1, (window) +1): print('input length of window ', x, ':') c = [int(x) x in input().split()] win1.append(c) print('input width of window ', x, ':') d = [int(x) x in input().split()] win2.append(d) print(win2, ':', win1) x in range(1, (door) +1): print('input length of door', x, ':') e = [int(x) x in input().split()] d1.append(e) print('input width of door ', x, ':') f = [int(x) x in input().split()] d2.append(f) print(d1, ':', d2) def listsum(wall1): if len(wall1) == 1: return wall1[0] else: return wall1[0] + listsum(wall1[1:]) print(listsum(wall1))
Comments
Post a Comment