Skip to content

Instantly share code, notes, and snippets.

@crazo7924
Created October 30, 2021 08:08
Show Gist options
  • Select an option

  • Save crazo7924/8e23ad110366796a08d8bb8e0553de76 to your computer and use it in GitHub Desktop.

Select an option

Save crazo7924/8e23ad110366796a08d8bb8e0553de76 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import sys
def print_fibonacci(howMany):
a, b = 0, 1
while a < howMany:
print(a)
a, b = b, a + b
def main():
limit = 0
if (len(sys.argv) != 2):
limit = 10
else:
try:
limit = int(sys.argv[1])
print_fibonacci(int(limit))
except ValueError as err:
print('An integer is required: {0}'.format(err))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment