正在加载图片...
Check Your Understanding:Fibonacci Define a function that returns an iterator that outputs up to the nth value in the Fibonacci sequence.You can assume n will always be 2 or greater Remember,iter(iterable)creates an iterator.Lists are iterables. def fib_iter(n): >>x fib_iter(4) >>next(x) 0 >>next(x) 1 >>next(x) 1 >>next(x) 2 Have you missed me?Define a function that returns an iterator that outputs up to the nth value in the Fibonacci sequence. You can assume n will always be 2 or greater ● Remember, iter(iterable) creates an iterator. Lists are iterables. def fib_iter(n): """ >>> x = fib_iter(4) >>> next(x) 0 >>> next(x) 1 >>> next(x) 1 >>> next(x) 2 """ Check Your Understanding: Fibonacci Have you missed me?
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有