0

I want to check how efficient my code is (time taken to run, and lines of code).
For example, how can I check whether this fibonacci code is efficient?

def fibonacci(start=0, end=10):
a = 0
b = 1

while True:
    if b >= end:
        break
    a, b = b, a+b

    if start <= a <= end:
        print(a)

fibonacci(start=10, end=45)
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
themthem
  • 533
  • 2
  • 11
  • 25
  • 1
    be careful with the indentation (function body should be shifted right). – grovina Dec 19 '17 at 16:47
  • Ultimately, 'efficiency' may be about how well your program compares with others. It's probable that others have written code to do this on https://codegolf.stackexchange.com. You could see how your stacks up. – Bill Bell Dec 19 '17 at 17:02

0 Answers0