Checkpoint 6.10.1.
- 2
- Though only two of the letters in the list are found, we count them each time they appear.
- 5
- Yes, we add to x each time we come across a letter in the list.
- 0
- Check again what the conditional is evaluating. The value of i will be a character in the string s, so what will happen in the if statement?
- There is an error in the code so it cannot run.
- There are no errors in this code.
What is printed by the following statements?
s = "We are learning!"
x = 0
for i in s:
if i in ['a', 'b', 'c', 'd', 'e']:
x += 1
print(x)