Hard
Make a Class Iterable
Write a class
Countdown(n) with __iter__ (using yield) that yields n, n−1, ..., 1. Read n and print list(Countdown(n)), then the sum.Input
One integer n ≥ 1.
Output
Two lines.
Sample 1
Input
5
Output
[5, 4, 3, 2, 1] 15
Sample 2
Input
1
Output
[1] 1
Output appears here