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
import numpy as np | |
#np.random.seed(0) | |
def sigmoid (x): | |
return 1/(1 + np.exp(-x)) | |
def sigmoid_derivative(x): | |
return x * (1 - x) | |
#Input datasets |
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
import requests | |
from bs4 import BeautifulSoup | |
import csv | |
url = 'https://www.worldometers.info/coronavirus/' | |
resp = requests.get(url) | |
soup = BeautifulSoup(resp.content, 'lxml') | |
data_table = soup.find('table', attrs={'id':'main_table_countries_today'}) |
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
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
raw_data = pd.read_csv('data.csv',encoding='latin1',thousands=',') | |
# Top 5 Countries Affected | |
data = raw_data[['Country,Other','TotalCases','TotalDeaths','TotalRecovered']] | |
most_affected = data.sort_values('TotalCases', ascending=False)[:5] | |
plt.figure(figsize=(10,5)) |
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
# -*- coding: utf-8 -*- | |
import cv2 | |
import numpy as np | |
def convulate(image, kernel, padding=False, paddingType=cv2.BORDER_CONSTANT): | |
''' | |
@param image: 2D array of type <numpy.ndarray> for given image. | |
@param kernel: 2D array of type <numpy.ndarray> for given kernel. | |
@param padding: Type <bool> to indicate if padding required. |
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
# -*- coding: utf-8 -*- | |
""" | |
Questions based on the session on Dynamic Programming by Apaar Kamal. | |
https://join.codingminutes.com/dp-08 | |
Alice and Bob are playing a game. Alice plays first. | |
We have a pile of n stones. | |
Q1. |
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
""" | |
A Python template to solve most problems involving substrings using a two-pointer approach. | |
Template based on this post: https://leetcode.com/problems/minimum-window-substring/discuss/26808/Here-is-a-10-line-template-that-can-solve-most-'substring'-problems | |
""" | |
def substring(string: str) -> int: | |
counter = int() # To check if the substring is valid | |
left, right = 0, 0 # Two pointers, right pointer is exclusive | |
length = int() # Length of the substring | |
map = dict() # Intialize the hash map here, collections.Counter is useful | |
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
// HackerRank's NodeJS environment allows the `request` package. | |
const request = require('request'); | |
function fetch(url) { | |
return new Promise((resolve, reject) => { | |
request(url, function (error, response, body) { | |
if (error) | |
reject(error) | |
else | |
resolve(body) |
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
# -*- coding: utf-8 -*- | |
''' | |
This is a program for University of Virginia's "Continous Delivery and DevOps" | |
course on Coursera. This script demonstrates the System Test example using | |
the Selenium webdriver. | |
''' | |
from random import randint | |
from selenium import webdriver |
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
Azure Fundamentals Part 1: Describe core Azure concepts | |
Cloud computing is the delivery of computing services over the internet by using a pay-as-you-go pricing model. You typically pay only for the cloud services you use, which helps you: | |
Lower your operating costs. | |
Run your infrastructure more efficiently. | |
Scale as your business needs change. | |
Types of Cloud Models | |
Public cloud | |
No capital expenditures to scale up. |
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
""" | |
A Python template to solve problems involving binary search. | |
Template based on this post: https://leetcode.com/problems/kth-smallest-number-in-multiplication-table/discuss/769704/Python-Clear-explanation-Powerful-Ultimate-Binary-Search-Template.-Solved-many-problems. | |
""" | |
def binary_search(array) -> int: | |
def condition(value) -> bool: | |
# Conditional logic based on question | |
# Returns true if current value satisfies requirements | |
# binary search will take care of finding the minimal val | |
return |
OlderNewer