2. This question practices the use of a list method. Assign to the variable grad
ID: 3747706 • Letter: 2
Question
2. This question practices the use of a list method. Assign to the variable grades a list of 10 letter grades from among "A", "B", "CD and "F" For example, grades [A', 'F', 'C', 'F', 'A', 'B', 'A','C','A", 'B,] 1 Write a Python expression that creates a list named frequency, in which the elements are the number of times each of the letters A, B, C, D and F appear in grades. For example, for the above value of grades, the following would be correct output. 1 frequency[4, 2, 2, 0, 2] Your expression must give the correct values for any list of grades, not just the one in your list. Hint: use the list method count. 3. This question practices list membership, list indexes and list slices. a. Write a Python statement that creates a list named dog breeds that contains the elements b. Write a Python statement that uses list slicing to create a list herding.dogs that is made c. Write a Python statement that uses list indexing to create a list tiny_dogs that is made up d. Write a Python statement that tests whether "Persian" is in the list dog_breeds and prints "collie", "sheepdog", "Chow", and "Chihuahua" up of the first two elements of dog.breeds. of the last element of dog.breeds. either True or False depending on the answer.Explanation / Answer
grades=list("AFCFABACAB")
unique_grade=set(grades)
unique_grade=list(unique_grade)
unique_grade.sort()
grade_count=list()
for letter in unique_grade:
grade_count.append(grades.count(letter))
print(unique_grade)
print(grade_count)
OUTPUT:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.