0

L=[200,1,34,56,'hi','hello','python',50,30,20]

Get sum of intigers in list of above shown . and also print string in the list .

25th Aug 2018, 12:34 PM
Madhu Sudhan
1 Réponse
+ 3
print(sum(x if type(x)==int else bool(print(x)) for x in L))
25th Aug 2018, 12:35 PM
VcC
VcC - avatar