repl.it
@Moo_moo_meadows/

How to use the for command

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def fibonacci(n):
  #returns the nth term in fibonacci where 0 is the 0th and 1 is the 1st
  if n==0:
    return(0)
  elif n==1:
    return(1)
  else:
    return(fibonacci(n-2)+fibonacci(n-1))
def phi(x):
  #x is like a derivative
  if x<=1:
    return('1/0 :/')
  else:
    return(fibonacci(x)/fibonacci(x-1))
for i in range(2, 101):
  print(i, phi(i))
Fetching token
?