This repository contains solutions to the homework assignments from a Python Bootcamp. The homework assignments cover various topics, including matrix operations, Fibonacci sequence calculation, data clustering with KMeans, web scraping, data visualization, and more.
- File:
fib_matrix.py
The fib_matrix.py file contains two functions: matrix_carp()
and fib()
. The matrix_carp()
function performs matrix multiplication between two 2x2 matrices, and the fib()
function calculates the nth Fibonacci number using matrix exponentiation. The power()
function is also used in the Fibonacci calculation.
- File:
k-means.py
The k-means.py file demonstrates data clustering using KMeans from the scikit-learn
library. The Iris dataset from scikit-learn is used for clustering. The data is plotted and clustered into three groups using KMeans algorithm.
- File:
currency.py
The currency.py file showcases web scraping using BeautifulSoup and requests libraries to extract currency exchange rate data for Sterling (GBP) from a website. The extracted data is then visualized using pandas
, matplotlib
, and seaborn
libraries, showing the buying and selling rates of GBP from various banks.
To run the code in this repository, you will need the following libraries installed:
pandas
tweepy
(for web scraping)nltk
(for text mining)textblob
(for sentiment analysis)numpy
(for matrix operations)matplotlib
(for data visualization)seaborn
(for data visualization)scikit-learn
(for KMeans clustering)BeautifulSoup
(for web scraping)requests
(for web scraping)
Clone or download this repository to your local machine.
Run the Python files using your Python environment (e.g., Jupyter Notebook, PyCharm, or any IDE supporting Python).
Ensure you have the required libraries installed before running the code. If not, use pip install
to install the missing libraries.