This file contains hidden or 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 viewer # Python Beat C# | |
# Python WON 🎉🎉🎉 | |
This file contains hidden or 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
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") |
This file contains hidden or 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 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") |
This file contains hidden or 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 | |
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 |
This file contains hidden or 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
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() |
This file contains hidden or 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 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 |
This file contains hidden or 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 cv2 | |
# for in-built camera | |
cam = cv2.VideoCapture(0) | |
# for external camera | |
cam = cv2.VideoCapture(0, cv2.CAP_DSHOW) |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |