+ 1

Please explain how 0 is the output?

a = [23,11,18,75,99] p= ages.count(99)-ages.count(11) print(p)

22nd Aug 2019, 2:38 PM
Navneet
Navneet - avatar
2 Respostas
+ 2
count() function returns the number of instances of the passed argument in the given list. Ex : ages. count (99), returns number of 99 in the list named ages...
22nd Aug 2019, 2:52 PM
Kuri
Kuri - avatar
+ 1
a.count(99) == 1 There is 1 int with the value 99 a.count(11) == 1 There is 1 int with value 11 p = 1 - 1 p = 0
22nd Aug 2019, 2:42 PM
Steven M
Steven M - avatar