generate functionWed, 22 Feb 2023

the total sum of integers entered on a new line must not exceed 'n'. if the sum of the input values exceeds 'n', output the word "Enough!, the last sum that does not exceed, and the number of values that do not exceed

def count_number(n): sum = 0 count = 0 while True: add_number = int(input()) sum += add_number count += 1 if sum >= n: return print('Enough!,', sum - add_number, count - 1) print(count_number(15))

Want to kickstart your project?Use the new AI Studio to create your code