Take average of a list after removing the non-numeric characters

后端 未结 0 877
别那么骄傲
别那么骄傲 2021-02-14 21:53

\'\'\'A = [1,2,\'a\',3,4,5,9,8]

total = 0

for i in A:

List = [x for x in A if isinstance(x, int)]
for t in List:
    total = total + t           
           


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题