Write a generator function count_up_to that takes a maximum value and yields numbers from 1 to this maximum. Then, write another generator function count_down_from that takes a starting value and yields numbers from starting value down to 1. Use yield from to combine both generators into a single generator function count_up_and_down.
Eg
def count_up_and_down(n):
yield from ...
yield from ...
generator = count_up_and_down(10)
for value in generator:
...
Write a generator function count_up_to that takes a maximum value and yields numbers from 1 to this maximum. Then, write another generator function count_down_from that takes a starting value and yields numbers from starting value down to 1. Use yield from to combine both generators into a single generator function
count_up_and_down
.Eg