The count of a list is the number of non-list elements that it contains. For example, the count of is 3, the count of is 4, the count of is 1, and the count of is 0.
Write a program that prints the count of every given list.
Define and use a recursive function
count(t)
that returns the count of a list .
Using the @ast@ package, you can extract the list encoded in a string with @t = ast.literal_eval(s)@.
The input consists of several lists.
Print the count of every given list.
You only need to submit the required procedure; your main program will be ignored.
Author: Gabriel Valiente
Generation: 2026-01-25T19:34:27.777Z
© Jutge.org, 2006–2026.
https://jutge.org