Skip to content

Instantly share code, notes, and snippets.

View codewithpom's full-sized avatar
🎯
Focusing

Padmashree Jha codewithpom

🎯
Focusing
View GitHub Profile
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
import time
options = Options()
options.add_argument("--disable-notifications")
options.add_argument("--headless")
driver = Chrome(chrome_options=options)
driver.get("https://facebook.com")
import matplotlib.pyplot as plt
y_axis = [4, 6, 7, 5, 9, 10]
# create y_axis list for y axis
x_axis = list(range(len(y_axis)))
# create x_axis list for x axis
plt.plot(x_axis, y_axis)
# plot the lists on the graph
plt.title("My first Matplotlib Graph")
import requests
url = "https://type.fit/api/quotes"
data = requests.get(url).json()
for i in data:
print(i['text'])
print(i['author'])
print()
print()
# Have fun
from selenium.webdriver import Chrome
# import the Chrome class
import time
driver = Chrome()
# create driver instance
driver.get("https://www.seleniumeasy.com/test/basic-first-form-demo.html")
time.sleep(3)
close_button = driver.find_element_by_id('at-cv-lightbox-close')
close_button.click()
import cv2
# I used this line because I have external camera.
# You do not need to use cv2.CAP_DSHOW if you do not use external camera
cam = cv2.VideoCapture(0, cv2.CAP_DSHOW)
while True:
ret, frame = cam.read()
cv2.imshow("My Webcam", frame)
key = cv2.waitKey(25)
if key == ord('q'):
break
import cv2
# for in-built camera
cam = cv2.VideoCapture(0)
# for external camera
cam = cv2.VideoCapture(0, cv2.CAP_DSHOW)
# create a string variable
name = "Padmashree"
# print every word after the fifth charachter
print(name[5:])
# prints shree
# print every word before the fifth charachter
print(name[:5])
# prints Padma
# create a string variable
name = "Padmashree"
# print the first charachter of the word
print(name[0])
# prints P
# print the last charachter of the word
print(name[-1])
# prints e
# declare a string variable
name = "Padmashree"
# print variable name in upper case
print(name.upper())
# print the vriable in lower case
print(name.lower())
# directly print a word in lower case
name = input("What is your name")
# take input from the user and save it in the name variable as string
# print the name
print(name)