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
# Rock-paper-scissors-lizard-Spock template | |
import random | |
# The key idea of this program is to equate the strings | |
# "rock", "paper", "scissors", "lizard", "Spock" to numbers | |
# as follows: | |
# | |
# 0 - rock | |
# 1 - Spock | |
# 2 - paper |
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 | |
import urllib.request | |
import time | |
from bs4 import BeautifulSoup | |
from lxml import html | |
import requests | |
import urllib | |
import numpy as np | |
import pandas as pd |
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
array = [1,3,6,10,15,32,43,46,100,150,170,290] # Given | |
def BinarySearch(array, target): | |
n = len(array) # length of array. | |
left = 0 # at starting are search space is | |
right = n-1 # full array(from index 0 to n-1) | |
# Now remember what we talk about condition for search. | |
# If are left and right index are same or they are at same positon | |
# It is time to stop. |
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 | |
finalList = [] | |
pages = [ 'https://simple.wikipedia.org/wiki/Category:Natural_resources', | |
'https://simple.wikipedia.org/wiki/Category:Hydrogen_compounds', | |
'https://simple.wikipedia.org/wiki/Category:Oxygen_compounds', | |
'https://simple.wikipedia.org/wiki/Category:Oxides'] | |
for i in range(len(pages)): | |
page = requests.get(pages[i]) | |
soup = BeautifulSoup(page.content, 'html.parser') |
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 time | |
from selenium import webdriver | |
import pandas as pd | |
# from webdriver_manager.chrome import ChromeDriverManager # Only required in Linux | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.common.exceptions import TimeoutException | |
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 os | |
import pandas as pd | |
path = '/home/shivank98/Desktop/Motion' # Set the path for folder where all pdf are kept. | |
files = [] | |
for r, d, f in os.walk(path): | |
for file in f: | |
if '.pdf' in file: | |
files.append(os.path.join(r, file)) |
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 time | |
from selenium import webdriver | |
import pandas as pd | |
#from webdriver_manager.chrome import ChromeDriverManager # Only required in Linux | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.common.exceptions import TimeoutException | |
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 time | |
from selenium import webdriver | |
import pandas as pd | |
from webdriver_manager.chrome import ChromeDriverManager # Only required in Linux | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.common.exceptions import TimeoutException | |
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 time | |
from selenium import webdriver | |
import pandas as pd | |
#from webdriver_manager.chrome import ChromeDriverManager # Only required in Linux | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.common.exceptions import TimeoutException | |
data = pd.read_excel(r'data.xlsx') |
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 time | |
import numpy as np | |
np_array = np.arange(1, 1000000) | |
python_list = range(1, 1000000) | |
np_start = time.time() | |
result = [i**2 for i in np_array] | |
np_end = time.time() | |
print('Total time taken by numpy = ', np_end-np_start) |
OlderNewer