Question at position 7 If the missing lines are filled in correctly, the program should continuously take a number from the user and add it to a total until they enter a negative number, where the program will end and output the total of all previous numbers. Negative numbers should NOT be included in the total. Below is an example output of the program, where bolded text is input to the program: Enter a number: 3Enter a number: 7Enter a number: -2Total: 10 [table] 1  total = 02 keep_adding = True3 4  while keep_adding:5 number = int(input('Enter a number: '))6 if number # ( code WILL go here ) 0:7 # ( code WILL go inside IF )8 else:9 # ( code WILL go inside ELSE )10 print('Total:', total) [/table] Which of the following options is the correct missing code? (Code filled in has been bolded.)6 if number > 0:7 keep_adding = True8 else:9 total = total + number6 if number < 0:7 total = total + number8 else:9 keep_adding = False6 if number < 0:7 keep_adding = False8 else:9 total = total + number6 if number <= 0:7 total = total + number8 else:9 keep_adding = TrueClear my selection单项选择题

A

6 if number > 0: 7         keep_adding = True 8     else: 9         total = total + number

B

6     if number < 0: 7         total = total + number 8     else: 9         keep_adding = False

C

6 if number < 0: 7         keep_adding = False 8     else: 9         total = total + number

D

6     if number <= 0: 7         total = total + number 8     else: 9         keep_adding = True

登录即可查看完整答案

我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!