Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Glenn Downing
executable file 43 lines (37 sloc) 0.494 kb
#!/usr/bin/env python3
"""
CS373: Quiz #13 (7 pts)
"""
""" ----------------------------------------------------------------------
1. What's the output of the following?
What is f() computing?
(6 pts)
False
True
1
1
2
3
1
Fibonacci
"""
def f () :
x, y = 1, 1
while True :
yield x
x, y = y, x + y
p = f()
q = f()
print(p is q)
r = iter(p)
print(r is p)
v = next(p)
print(v)
v = next(p)
print(v)
v = next(p)
print(v)
v = next(p)
print(v)
v = next(q)
print(v)
Jump to Line
Something went wrong with that request. Please try again.