Skip to content

Create Fibonacci.py #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions standard_lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ A collection of useful snippets using only the standard library.
| drawing_turtle | Drawing a dragon symbol using Python's built-in turtle |
| empty_set_literal | Create an empty set using a literal |
| emulate_switch_case | Emulate switch-case-statements as they don't exist in Python |
| fibonacci | Display fibonacci series upto number given by user |
| file_matching_regex | Find matching files using `re` and `fnmatch` |
| fill_zeros | Fill strings using leading zeros. |
| flatten | Flatten a nested iterable |
Expand Down
9 changes: 9 additions & 0 deletions standard_lib/fibonacci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def fibonacci(n):
a, b = 0, 1
for _ in range(n):
print(a, end=' ')
a, b = b, a + b

# Get input from user
num = int(input("Enter number of terms: "))
fibonacci(num)