mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Added Fibonacci_Sequence_Generator and updated main README.md accordingly (#173)
This commit is contained in:
parent
27f2a0e8b6
commit
881f70e6e8
23
Fibonacci_Sequence_Generator/Fibonacci.py
Normal file
23
Fibonacci_Sequence_Generator/Fibonacci.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
def Fibbo_Sequence_Generator():
|
||||||
|
# Generates a fibonacci sequence with the size of ngi
|
||||||
|
runFib = True
|
||||||
|
while(runFib):
|
||||||
|
n = int(input('How many numbers do you need? '))
|
||||||
|
if n > 0 :
|
||||||
|
runFib = False
|
||||||
|
series = [1]
|
||||||
|
|
||||||
|
while len(series) < n:
|
||||||
|
if len(series) == 1:
|
||||||
|
series.append(1)
|
||||||
|
else:
|
||||||
|
series.append(series[-1] + series[-2])
|
||||||
|
|
||||||
|
for i in range(len(series)): # Convert the numbers to strings
|
||||||
|
series[i] = str(series[i])
|
||||||
|
else:
|
||||||
|
print('enter a valid number')
|
||||||
|
|
||||||
|
return(', '.join(series)) # Return the sequence seperated by commas
|
||||||
|
|
||||||
|
print(Fibbo_Sequence_Generator())
|
10
Fibonacci_Sequence_Generator/README.md
Normal file
10
Fibonacci_Sequence_Generator/README.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Python Fibonacci Sequence Generator
|
||||||
|
This python script will ask you how many numbers do you need to see in the Fibonacci Sequence and generates the sequence based on your input.
|
||||||
|
|
||||||
|
## Requirement
|
||||||
|
Python 3.xx
|
||||||
|
|
||||||
|
## Running the script
|
||||||
|
```bash
|
||||||
|
python Fibonacci.py
|
||||||
|
```
|
|
@ -100,6 +100,7 @@ So far, the following projects have been integrated to this repo:
|
||||||
|[Excel Files Merger](Excel_Files_Merger) | [Andrei N](https://github.com/Andrei-Niculae)|
|
|[Excel Files Merger](Excel_Files_Merger) | [Andrei N](https://github.com/Andrei-Niculae)|
|
||||||
|[Excel to List](Excel_to_ListofList) | [Nitish Srivastava](https://github.com/nitish-iiitd)|
|
|[Excel to List](Excel_to_ListofList) | [Nitish Srivastava](https://github.com/nitish-iiitd)|
|
||||||
|[Extended_ip_address_info](extended_ip_address_info) | [hafpaf](https://github.com/hafpaf)|
|
|[Extended_ip_address_info](extended_ip_address_info) | [hafpaf](https://github.com/hafpaf)|
|
||||||
|
|[Fibonacci_Sequence_Generator](Fibonacci_Sequence_Generator) | [John Wesley Kommala](https://github.com/JohnWesleyK)|
|
||||||
|[File explorer](File-Explorer-Dialog-Box) | [Nikhil Kumar Singh](https://github.com/nikhilkumarsingh)|
|
|[File explorer](File-Explorer-Dialog-Box) | [Nikhil Kumar Singh](https://github.com/nikhilkumarsingh)|
|
||||||
|[File Sharing Bot](File-Sharing-Bot) | [Darshan Patel](https://github.com/DarshanPatel11)|
|
|[File Sharing Bot](File-Sharing-Bot) | [Darshan Patel](https://github.com/DarshanPatel11)|
|
||||||
|[Flash card quizzer](Flash-card-Challenge) |[Utkarsh Sharma](https://github.com/Utkarsh1308) |
|
|[Flash card quizzer](Flash-card-Challenge) |[Utkarsh Sharma](https://github.com/Utkarsh1308) |
|
||||||
|
|
Loading…
Reference in New Issue
Block a user