Given grades = ["A", "B", "A", "C", "A", "B", "A"], use .count() to print how many times "A" appears
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
Problem
Given grades = ["A", "B", "A", "C", "A", "B", "A"], use .count() to print how many times "A" appears. Then use a list comprehension with enumerate() to build a list of all indices where "A" appears and print it.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.