### Thread: Does this look right for what I want to do??!!??

1. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Feb 2004
Posts
30
Rep Power
11

#### Does this look right for what I want to do??!!??

I am trying to right a program that allows you to type in any number and it will start at 1 and keep doubleing till it gets to the number just for fun.

Code:

def fib(n)

input = "Pick a Number", x
a, b = 0, 1
while b < n
print b;
a, b = b, a+b

fib(x)
2. No Profile Picture
Registered User
Devshed Newbie (0 - 499 posts)

Join Date
Feb 2004
Location
Germany
Posts
11
Rep Power
0
Code:
```def fib(n):
n = int(raw_input("Number: "))
b = 1
while b <= n:
print "%d" % int(b)
b = b + 1

fib(n)```
Last edited by Naddel; March 2nd, 2004 at 03:31 PM.
3. Here you have it, just a very simple example... as you said, the number keeps doubleing untill it gets to the limit you supply

Code:
```>>> l = int(raw_input('Enter a number '))
Enter a number 100
>>> n = 1
>>> while n <= l:
print n
n = n * 2

1
2
4
8
16
32
64
>>>```
Mark