So I am coding in python and want to make a simple yet neat program that would display every number inbetween 1 and pi, but it crashed. here's my code
i = 1
while i < 3.14159265359:
(imaginge it tabbed) i = 1/i + i
(imaginge it tabbed) print i
>>252915
>every number
I'm doubtful.
There's no reason it should be crashing based on what you have (assuming you're on 2.7). If you are running it through the console, it's probably just printing it and closing because there's nothing to keep it from closing.
i dont understand enough algebra to know what youre doing in that third line.
you could make a list with range 0 to 3.14... and then print the numbers in the list
:code:
import numpy as np
for i in np.arange(0, 3.14, .01):
print i
:stopcode:
>>252936
[code]
import numpy as np
for i in np.arange(0, 3.14, .01):
print i
[/code]
i = 1
while i <= 3.14159265359:
space print i
space i += 0.00000000001