def wut(data):
s = 0
for dic in data:
for i,value in dic.items():
if value == "True":
s += 1
return s
data = [{'id': 1, 'success': True, 'name': 'Lary'},
{'id': 2, 'success': False, 'name': 'Rabi'},
{'id': 3, 'success': True, 'name': 'Alex'}]
wutewa = data
print wut(wutewa)
Hello, the code above when fed into python tutor doesn't move forward with checking if value=="True"
, I'm not sure where I went wrong. I know I could use sum
function but I have this thing that if I try and use as much as data structures as possible I'll be able to develop a way of thinking to code.