已采纳回答 / 慕粉1011555035
Do you want something like below?n = 1sum = 0while True: x = 2**(n-1) n = n + 1 sum = sum + x if n > 20: breakprint sum
2016-10-01