# python fibonacci

Page 1 of 1

## 2 Replies - 301 Views - Last Post: 01 May 2013 - 06:48 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=320013&amp;s=3fa5949738f18c2474ac7fd4392147e6&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 xxhunt3rzxx

• New D.I.C Head

Reputation: 0
• Posts: 1
• Joined: 01-May 13

# python fibonacci

Posted 01 May 2013 - 06:07 AM

im a fresh man how ca i print the fibo sequence and i start in 0 heres my code

```while 1:
c = input("\nenter a number: ")
num1 = 0
num2 = 1
for i in range(c):
print num2,
num1=num2-num1
num2=num2+num1

```

This post has been edited by jon.kiparsky: 01 May 2013 - 06:44 AM
Reason for edit:: code tags

Is This A Good Question/Topic? 0

## Replies To: python fibonacci

### #2 modi123_1

• Suitor #2

Reputation: 10015
• Posts: 38,237
• Joined: 12-June 08

## Re: python fibonacci

Posted 01 May 2013 - 06:47 AM

Typically 'print' works pretty well.
Was This Post Helpful? 0

### #3 jon.kiparsky

• Pancakes!

Reputation: 8371
• Posts: 14,425
• Joined: 19-March 11

## Re: python fibonacci

Posted 01 May 2013 - 06:48 AM

[me being an idiot deleted]

EDIT: I'm an idiot. No, that works. The only problem is you're not printing the initial seed numbers. You could just print those manually.

This post has been edited by jon.kiparsky: 01 May 2013 - 06:57 AM

Was This Post Helpful? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }