I am beginner programmer in python and i dont know why the input of this code isnt as i expect it to be:
I am beginner programmer in python and i dont know why the input of this code isnt as i expect it to be:
def count_smileys(arr):
#the number of valid smiley faces in array/list
smileys_count = 0
for character in arr:
if len(character) == 2:
if character[0] == ":" or character[0] == ";" and character[2] == ")" or character[2] == "D":
smileys_count += 1
if len(character) == 3:
if character[0] == ":" or character[0] == ";" and character[2] == ")" or character[2] == "D" and character[2] == "-" or character[2] == "~":
smileys_count +=1
return(smileys_count)
and the output is this :