Exes and Ohs

* *
链接 Exes and Ohs
难度 7kyu
状态
日期 2018-11-25

题意

题解1

def xo(s):
    a = 0
    b = 0
    for i in s:
        if i == 'x' or i == 'X':
            a += 1
    for j in s:
        if j == 'o' or j == 'O':
            b += 1
    if a ==b:
        return True
    else:
        return False

题解2

def xo(s):
    a = 0
    b = 0
    for c in s:
        if c == 'x' or c == 'X':
            a += 1
        if c == 'o' or c == 'O':
            b += 1
    if a == b:
        return True
    else:
        return False

题解3

def xo(s):
    a = 0
    b = 0
    for c in s:
        if c == 'x' or c == 'X':
            a += 1
        if c == 'o' or c == 'O':
            b += 1
    return a == b

你可能感兴趣的:(Exes and Ohs)