A shared tag with AI prompts and code snippets
From workspace: Python
Team: Main
Total snippets: 13
13 snippets
# -*- coding: utf-8 -*- """ Created on Fri Jun 4 18:02:01 2021 @author: Ayush """ import time import random import gym import numpy as np from IPython.display import clear_output env = gym.make('Taxi-v3') episodes = 10 for episode in range(1,...
# imports import sys from spellchecker import SpellChecker from nltk import word_tokenize # create an instance of the spellchecker spell = SpellChecker() # tokens --> stores the tokenized words tokens = [] def...
# importing packages & modules from PIL import Image, ImageDraw, ImageFont import pandas as pd import os # Implementation to generate certificate df = pd.read_csv('list.csv') font = ImageFont.truetype('arial.ttf', 60) for index, j in...
import pandas as pd def generate_data_report(data_file_path, report_file_path): df = pd.read_csv(data_file_path) summary_statistics = df.describe() column_means = df.mean() column_max_values = df.max() column_min_values =...
import sys import requests from bs4 import BeautifulSoup import time def display_content(url, selector): try: # Send a GET request to the URL response = requests.get(url) # Check if the request was successful ...
import os import shutil def automated_backup(source_dir, destination_dir): try: # Check if the source directory exists if not os.path.exists(source_dir): print(f"Source directory '{source_dir}' does not exist.") ...
from googlesearch import search import sys class googlesearch: def __init__(self): self.search_count = None self.keyword_to_search = None self.search_results = None def set_search_count(self): # Set the...
import unittest class Game: def __init__(self): self.is_running = False self.score = 0 def start(self): self.is_running = True return "Game started." def play(self, action): if...
import pyautogui import time import webbrowser from selenium import webdriver from time import sleep from webdriver_manager.chrome import ChromeDriverManager from getpass import getpass LOGIN_URL = 'https://www.facebook.com/login.php' num =...
from selenium import webdriver # connect python with webbrowser-chrome from selenium.webdriver.common.keys import Keys import pyautogui as pag def main(): url = "http://linkedin.com/" # url of LinkedIn network_url =...
import csv import time from selenium import webdriver from selenium.webdriver.common.keys import Keys inputName = '/html/body/div/div[2]/form/div[2]/div/div[2]/div[1]/div/div/div[2]/div/div[1]/div/div[1]/input' inputEmailID =...
""" Simple backup script which just creates the root structure in an other folder and syncs everything which recursively lies within one of the source folders. For files bigger than a threshold they are first gziped.""" import argparse import...
# Pandas library is used for importing and reading the data import pandas as pd # datetime module is used for fetching the dates import datetime import smtplib # smtp library used for sending mail import os current_path =...