单选题 适中
#16762

执行以下代码后,输出结果是?() s = "programming" vowels = "aeiou" count = 0 for char in s : if…

执行以下代码后,输出结果是?()

s = "programming"
vowels = "aeiou"
count = 0
for char in s:
    if char not in vowels:
        count += 1
print(count)
未登录也能判分,登录后才会记录
答案与解析
正确答案:C
解析
遍历字符串s中的每个字符,检查该字符是否不在vowels字符串中。若不在,则count变量加1。初始化count为0,循环处理s的每一个字符后,输出count值。