r/shittyprogramming • • Jul 12 '19

This is technically N(0), amirite?

import requests
from lxml import html

def fibonacci(n):
    sequence = ()
    while n >= len(sequence):
        sequence_html = html.fromstring(requests.get('https://oeis.org/A000045').content)
        sequence = sequence_html.xpath('//tt/text()')[0].split(', ')
    return int(sequence[n])
109 Upvotes

26 comments sorted by

View all comments

Show parent comment

1

u/Miserable_Fuck Jul 12 '19

That sounds like shitty programming to me.

What's the problem?

8

u/trimeta Jul 12 '19

I thought "pulling the sequence from an online source" would be shitty enough, failing to even accomplish that task seems excessively shitty.