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
# bot.py | |
import os # for importing env vars for the bot to use | |
from twitchio.ext import commands | |
import random | |
import sys | |
chatters = [] | |
bot = commands.Bot( | |
# set up the bot | |
irc_token=os.environ['TMI_TOKEN'], |
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
from selenium import webdriver | |
from selenium.common.exceptions import NoSuchElementException | |
from selenium.webdriver.common.keys import Keys | |
import win10toast | |
from selenium.webdriver.support.ui import WebDriverWait | |
import time | |
path = "C:\Program Files (x86)\chromedriver.exe" | |
driver = webdriver.Chrome(path) | |
toaster = win10toast.ToastNotifier() |
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 kebabize(string): | |
"""Modify the kebabize function so that it converts a camel case string into a kebab case.""" | |
for letter in string: | |
if letter.isupper(): | |
string = string.replace(letter, "-" + letter.lower()) | |
elif letter.isdigit(): | |
string = string.replace(letter, "") | |
return string.lstrip("-") | |
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 re | |
def travel(r, zipcode): | |
"""The function travel will take two parameters r (addresses' list of all clients' as a string) and zipcode and | |
returns a string in the following format: | |
zipcode:street and town,street and town,.../house number,house number,... | |
The street numbers must be in the same order as the streets where they belong. | |
If a given zipcode doesn't exist in the list of clients' addresses return "zipcode:/""" | |
number_of_house, street = [], [] |
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
from collections import Counter | |
def duplicate_count(text): | |
"""Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric | |
digits that occur more than once in the input string. The input string can be assumed to contain only alphabets ( | |
both uppercase and lowercase) and numeric digits. """ | |
return sum([1 for a in Counter(text.lower()).values() if a > 1]) | |
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 solve(n): | |
f0, f1 = "0", "01" | |
if n == 0: | |
return f0 | |
elif n == 1: | |
return f1 | |
elif n > 1: | |
for i in range(2, n + 1): | |
b = f0 | |
f0 = f1 |
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
from telebot import types | |
from telebot.apihelper import ApiException | |
import config | |
import telebot | |
import requests | |
from bs4 import BeautifulSoup | |
from googletrans import Translator | |
bot = telebot.TeleBot(config.TOKEN, parse_mode="html") |
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 sys | |
import pywinauto | |
import requests | |
from bs4 import BeautifulSoup | |
import pyautogui as gui | |
import winreg as reg | |
import ctypes | |
import subprocess |
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
#!python3 | |
import os | |
import re | |
"""As an added challenge, write another program that can insert gaps into numbered files so that a new file can be | |
added. """ | |
working_directory = input("Input your working directory with files: ") | |
numbers = [[correct_number + 1, number_of_file] for foldername, subfolder, filename in |
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
#!python3 | |
import os | |
import re | |
"""Write a program that finds all files with a given prefix, such as spam001.txt , spam002.txt , | |
and so on, in a single folder and locates any gaps in the numbering (such as if there is a | |
spam001.txt and spam003.txt but no spam002.txt ). | |
Have the program rename all the later files to close this gap.""" |
NewerOlder