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
def decorator_for_print(function): | |
def print_args(*args): | |
print('GIVEN arguments are ', args) | |
return function(args) | |
return print_args | |
@decorator_for_print | |
def func(alist): | |
return alist |
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
@decorator2 | |
@decorator1 | |
def func(arg1, arg2, ...): | |
pass | |
#IS EQUIVALENT OF | |
def func(arg1, arg2, ...): | |
pass | |
func = decorator2(decorator1(func)) |
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) |
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 | |
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 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 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
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. |
NewerOlder