Skip to content

Instantly share code, notes, and snippets.

View niranjandasMM's full-sized avatar
🎯
Focusing

Niranjjj niranjandasMM

🎯
Focusing
  • Coimbatore, India
View GitHub Profile
@niranjandasMM
niranjandasMM / Fibonacci_sequence_in_3_lines.py
Created January 14, 2023 06:29
Python3 | Using a Data structure
# We all know the Series starts with 0 and 1
temp = [0,1] # you can change to [1,1], [20,21] anything , first 2 values should be there
# then we are just adding the 1st ith and 2nd ith but plus 1
[ temp.append( temp[i]+ temp[i+1] ) for i in range(10) ]
print(temp)
#----------------------output-----------------------#
# [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
@niranjandasMM
niranjandasMM / knn-algo.py
Last active August 14, 2022 10:31
KNN-Machine learning Algortihm from scratch using Iris dataset and visualizing it
# Import the required libraries
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
import pandas as pd
from collections import defaultdict
from math import sqrt
from collections import Counter
from sklearn.model_selection import train_test_split