generate functionWed, 22 Feb 2023

the total sum of integers entered on a new line must not exceed 'n'. before the sum exceeds for one input before exceeding it is necessary to print the word 'enough' and the sum of the input chichel and the number of numbers

n = int(input()) sum_ = 0 i = 0 while sum_ < n: x = int(input()) sum_ += x i += 1 if sum_ >= n: break print('sum:', sum_) print('number of numbers:', i)

Questions about programming?Chat with your personal AI assistant