This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Plotting Kernel Density Estimate - Estimate of Probability Density Function | |
#Means of smoothing data | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
means = 15, 35 | |
stdevs = 6, 12 | |
distro = pd.DataFrame(np.random.normal(loc=means, scale=stdevs, size=(2000,2)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Simple Ceasar Cipher - Cryptography | |
class CaesarCipher: | |
#Class for doing ecryption and decryption using Ceasar cipher | |
def __init__(self,shifter): | |
#Costruct cipher using integer shift of alphabet | |
encoderList = [None] * 26 | |
decoderList = [None] * 26 | |
for i in range(26): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Creating a list using List Comprehension | |
squares = [] | |
for i in range(1,11): | |
squares.append(i*i) | |
print(squares) | |
squares = [i*i for i in range(1,15)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Second part to recursion videos | |
Printing out all subsets of a list of numbers | |
using recursion | |
''' | |
def subset(input): | |
if input == []: | |
return [[]] | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Showing simple recursion example | |
def recursionFunc(input): | |
if input <= 1: | |
return 1 | |
else: | |
return input * recursionFunc(input - 1) | |
someInput = recursionFunc(4) | |
print(someInput) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Creating a calculator that gets multiple input from the user | |
from functools import reduce | |
def addition(*args): | |
newList = [] | |
for i in inputList: | |
z = int(i) | |
newList.append(z) | |
NumbersSum = sum(newList) | |
return NumbersSum |