Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120436479
fib.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jul 4, 09:10
Size
608 B
Mime Type
text/x-python
Expires
Sun, Jul 6, 09:10 (2 d)
Engine
blob
Format
Raw Data
Handle
27170732
Attached To
R232 fabrepos2
fib.py
View Options
# Just a little test program
from
sys
import
stderr
class
FibSeries
:
"""Returns all the elements of Fibonacci series up to a given number.
Requires one parameter (the number we're going up to)."""
def
__init__
(
self
,
number
):
self
.
series
=
[
1
,
1
]
a
,
b
=
1
,
1
while
b
<
number
:
a
,
b
=
b
,
a
+
b
if
b
<
number
:
self
.
series
.
append
(
b
)
def
writeout
(
self
):
cnt
=
0
while
cnt
<
len
(
self
.
series
):
stderr
.
write
(
str
(
self
.
series
[
cnt
])
+
" "
)
cnt
+=
1
stderr
.
write
(
"
\n
"
)
meine
=
FibSeries
(
115
)
meine
.
writeout
()
Event Timeline
Log In to Comment