repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Colors/multicoloredline.py
Colors/multicoloredline.py
from rich.console import Console from rich.syntax import Syntax from rich.progress import Progress, SpinnerColumn, BarColumn, TextColumn from rich.table import Table import time import json console = Console() # Fancy separator console.rule("[bold]Welcome to Rich Terminal[/bold]", style="rainbow") # Define some JSON...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Colors/primary_colors.py
Colors/primary_colors.py
def diff(a, b): """ TODO: fix this function!! """ return a - b def simpleColor(r, g, b): """simpleColor obtiene el nombre del color mas general al cual se acerca su formato R G B""" r = int(r) g = int(g) b = int(b) bg = ir = 0 # TODO: Fix these variables try: # ROJO --...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Colors/pixel_sort.py
Colors/pixel_sort.py
"""Pixel Sorting""" # Importing Libraries import cv2 import numpy as np import math import colorsys import pandas as pd import os import argparse from tqdm import tqdm # Importing the external file Library import sound # Taking arguments from command line parser = argparse.ArgumentParser() # you iniatize as such pa...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Colors/print_colors.py
Colors/print_colors.py
import sys class colors: CYAN = "\033[36m" GREEN = "\033[32m" YELLOW = "\033[33m" BLUE = "\033[34m" RED = "\033[31m" ENDC = "\033[0m" def printc(color, message): print(color + message + colors.ENDC) printc(colors.CYAN, sys.argv[1]) printc(colors.GREEN, sys.argv[1]) printc(colors.YELLOW...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/ImageDownloader/img_downloader.py
ImageDownloader/img_downloader.py
# ImageDownloader - Muhammed Shokr its amazing def ImageDownloader(url): import os import re import requests response = requests.get(url) text = response.text p = r'<img.*?src="(.*?)"[^\>]+>' img_addrs = re.findall(p, text) for i in img_addrs: os.system("wget {}".format(i)) ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/CRC/crc.py
CRC/crc.py
def crc_check(data, div): l = len(div) ct = 0 data = [int(i) for i in data] div = [int(i) for i in div] zero = [0 for i in range(l)] temp_data = [data[i] for i in range(l)] result = [] for j in range(len(data) - len(div) + 1): print("Temp_dividend", temp_data) msb = temp_...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/BrowserHistory/rock_paper_scissors.py
BrowserHistory/rock_paper_scissors.py
""" Triple Round : Rock, Paper, Scissors Game (CLI Version) Final round is the Winning Round Author: Your Name """ import random def get_user_choice(): """Prompt the user to enter their choice.""" choice = input("Enter your choice (rock, paper, scissors): ").lower() if choice in ["rock", "paper", "scisso...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/BrowserHistory/backend.py
BrowserHistory/backend.py
class DLL: """ a doubly linked list that holds the current page, next page, and previous page. Used to enforce order in operations. """ def __init__(self, val: str = None): self.val = val self.nxt = None self.prev = None class BrowserHistory: """ This class des...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/BrowserHistory/tests/test_browser_history.py
BrowserHistory/tests/test_browser_history.py
import unittest import sys import os # Add parent directory to path to import backend sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from backend import BrowserHistory class TestBrowserHistory(unittest.TestCase): def setUp(self): """Set up test cases""" self.browser ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/stone_paper_scissor/main.py
stone_paper_scissor/main.py
import utils # import the random module import random print("Starting the Rock Paper Scissors game!") player_name = input("Please enter your name: ") # Takes Input from the user print("Pick a hand: (0: Rock, 1: Paper, 2: Scissors)") while True: try: player_hand = int(input("Please enter a number (0-2):...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/stone_paper_scissor/utils.py
stone_paper_scissor/utils.py
def validate(hand): if hand < 0 or hand > 2: return False return True def print_hand(hand, name="Guest"): hands = ["Rock", "Paper", "Scissors"] print(name + " picked: " + hands[hand]) def judge(player, computer): if player == computer: return "Draw" elif player == 0 and compu...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/text_to_audio/main.py
text_to_audio/main.py
# A exclusive CLI version can be made using inquirer library. from gtts import gTTS from io import BytesIO # only use when needed to avoid memory usage in program """_summary_ def some_function(): # Pygame module is only imported when this function is called import pygame.mixer as mixer mixer.init() # US...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/BlackJack_game/blackjack_rr.py
BlackJack_game/blackjack_rr.py
import random class Colour: BLACK = "\033[30m" RED = "\033[91m" GREEN = "\033[32m" END = "\033[0m" suits = ( Colour.RED + "Hearts" + Colour.END, Colour.RED + "Diamonds" + Colour.END, Colour.BLACK + "Spades" + Colour.END, Colour.BLACK + "Clubs" + Colour.END, ) ranks = ( "Two", ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/BlackJack_game/blackjack_simulate.py
BlackJack_game/blackjack_simulate.py
import os import random from functools import namedtuple """ Target: BlackJack 21 simulate - Role - Dealer: 1 - Insurance: (When dealer Get A(1) face up) - When dealer got 21 - lost chips - When dealer doesn't got 21 - win ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/BlackJack_game/blackjack.py
BlackJack_game/blackjack.py
# master # master # BLACK JACK - CASINO A GAME OF FORTUNE!!! from time import sleep # BLACK JACK - CASINO # PYTHON CODE BASE # master import random deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11] * 4 random.shuffle(deck) print(f"{'*' * 58} \n Welcome to the game Casino - BLACK JACK ! \n{'*' * 58}") sleep(2...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Google_Image_Downloader/image_grapper.py
Google_Image_Downloader/image_grapper.py
#!/usr/bin/python # -*- coding: utf-8 -*- # importing required libraries import json from os import chdir, system from os import walk from os.path import curdir from os.path import pardir from urllib.parse import urlencode from urllib.request import urlopen, Request import requests import ssl from bs4 import Beautiful...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Google_Image_Downloader/create_dir.py
Google_Image_Downloader/create_dir.py
""" Code to directly use in file to create directory in home location Note:- I Have used python package so if you want to create in the main directory of your project use pardir+"\\"+name in functions All the folder operations are done on home project directory. """ from os import chdir from os import makedirs from ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Key_Binding/key_binding.py
Key_Binding/key_binding.py
from quo.keys import bind from quo.prompt import Prompt session = Prompt() @bind.add("ctrl-h") def _(event): print("Hello, World") session.prompt("")
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Face_Mask_detection (haarcascade)/mask_detection.py
Face_Mask_detection (haarcascade)/mask_detection.py
import tensorflow.keras import numpy as np import cv2 # import os str = "" faceCascade = cv2.CascadeClassifier("Resources/haarcascade_frontalface_default.xml") np.set_printoptions(suppress=True) model = tensorflow.keras.models.load_model("Resources/keras_model.h5") data = np.ndarray(shape=(1, 224, 224, 3), dtype=np....
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/communication/pipe.py
communication/pipe.py
# coding: utf-8 from __future__ import print_function import math import os import sys def slice(mink, maxk): s = 0.0 for k in range(mink, maxk): s += 1.0 / (2 * k + 1) / (2 * k + 1) return s def pi(n): childs = {} unit = n / 10 for i in range(10): # 分10个子进程 mink = unit * ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/communication/file.py
communication/file.py
#!/usr/bin/python # coding: utf-8 import math import os import sys def slice(mink, maxk): s = 0.0 for k in range(int(mink), int(maxk)): s += 1.0 / (2 * k + 1) / (2 * k + 1) return s def pi(n): pids = [] unit = n / 10 for i in range(10): # 分10个子进程 mink = unit * i max...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/communication/socket_conn.py
communication/socket_conn.py
# coding: utf-8 from __future__ import print_function import math import os import socket import sys def slice(mink, maxk): s = 0.0 for k in range(mink, maxk): s += 1.0 / (2 * k + 1) / (2 * k + 1) return s def pi(n): childs = {} unit = n / 10 for i in range(10): # 分10个子进程 ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/QR_code_generator/qrcode.py
QR_code_generator/qrcode.py
import pyqrcode # from pyqrcode import QRCode # no need to import same library again and again # Creating QR code after given text "input" url = pyqrcode.create(input("Enter text to convert: ")) # Saving QR code as a png file url.show() # Name of QR code png file "input" url.png(input("Enter image name to save: ") + "...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/send_message_automation/message_automation.py
send_message_automation/message_automation.py
import pyautogui from time import sleep # Do you want to include the message counter? # make a class of it. # Can make a broswer session open and navigating to web.whatsapp # os dependencies and browser dependencies and default browser if none # also check for whatsapp on the system def send_message(message): p...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/QuestionAnswerVirtualAssistant/backend.py
QuestionAnswerVirtualAssistant/backend.py
import sqlite3 import json import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer class QuestionAnswerVirtualAssistant: """ Used for automatic question-answering It works by building a reverse index store that maps words to an id. To find the indexed questions that contain ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/QuestionAnswerVirtualAssistant/frontend.py
QuestionAnswerVirtualAssistant/frontend.py
from tkinter import * import backend def index_question_answer(): # for this, we are separating question and answer by "_" question_answer = index_question_answer_entry.get() question, answer = question_answer.split("_") print(question) print(answer) va = backend.QuestionAnswerVirtualAssistant...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/JustDialScrapperGUI/Justdial Scrapper GUI.py
JustDialScrapperGUI/Justdial Scrapper GUI.py
import csv import threading import urllib.request from tkinter import HORIZONTAL, Button, Entry, Label, Tk from tkinter.ttk import Progressbar from bs4 import BeautifulSoup class ScrapperLogic: def __init__(self, query, location, file_name, progressbar, label_progress): self.query = query self.lo...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/insta_monitering/insta_datafetcher.py
insta_monitering/insta_datafetcher.py
# only god knows whats happening in the code # if I forget the code structure # please pray to god for help import asyncio import multiprocessing import os import random import re import socket import sys import time import bs4 import pymongo import requests import socks import ujson import urllib3 try: import i...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/insta_monitering/con_file.py
insta_monitering/con_file.py
host = "localhost" mongoPort = 27017 SOCKS5_PROXY_PORT = 1080 auth = "" passcode = "" # if proxy is not working please update the auth and passcode
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/insta_monitering/insta_api.py
insta_monitering/insta_api.py
from concurrent.futures import ThreadPoolExecutor import tornado.ioloop import tornado.web from tornado.concurrent import run_on_executor from tornado.gen import coroutine # import file try: from instagram_monitering.insta_datafetcher import * from instagram_monitering.subpinsta import * except: from inst...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/insta_monitering/subpinsta.py
insta_monitering/subpinsta.py
# trggering the process import os import subprocess import sys def instasubprocess(user, tags, type, productId): try: child_env = sys.executable file_pocessing = ( os.getcwd() + "/insta_datafetcher.py " + user + " " + tags + "...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Assembler/assembler.py
Assembler/assembler.py
from __future__ import print_function import sys lines = [] # contains the lines of the file. tokens = [] # contains all tokens of the source code. # register eax, ebx,..., ecx eax = 1 ebx = 0 ecx = 0 edx = 0 # status register zeroFlag = False # stack data structure # push --> append # pop --> pop stack = [] # ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
true
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/password_programs_multiple/animal_name_scraiper.py
password_programs_multiple/animal_name_scraiper.py
import requests from bs4 import BeautifulSoup # * Using html5lib as the parser is good # * It is the most lenient parser and works as animals_A_to_Z_URL = "https://animalcorner.org/animal-sitemap/#" results = requests.get(animals_A_to_Z_URL) # ? results and results.text ? what are these? # soup = BeautifulSoup(resu...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/password_programs_multiple/passwordGenerator.py
password_programs_multiple/passwordGenerator.py
# PasswordGenerator GGearing 314 01/10/19 # modified Prince Gangurde 4/4/2020 import random import pycountry def generate_password(): # Define characters and word sets special_characters = list("!@#$%/?<>|&*-=+_") animals = ( "ant", "alligator", "baboon", "badger", ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Hand-Motion-Detection/hand_motion_recognizer.py
Hand-Motion-Detection/hand_motion_recognizer.py
import mediapipe as mp import cv2 mp_drawing = mp.solutions.drawing_utils mp_hands = mp.solutions.hands cap = cv2.VideoCapture(0) with mp_hands.Hands(min_detection_confidence=0.8, min_tracking_confidence=0.5) as hands: while cap.isOpened(): ret, frame = cap.read() # BGR 2 RGB image = cv2...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Snake_water_gun/main.py
Snake_water_gun/main.py
# This is an edited version # Made the code much more easier to read # Used better naming for variables # There were few inconsistencies in the outputs of the first if/else/if ladder \ # inside the while loop. That is solved. import random import time from os import system class bcolors: HEADERS = "\033[95m" ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/ultimate-phone-book/contacts.py
ultimate-phone-book/contacts.py
# code by @JymPatel # edited by @bupboi1337, (editors can put their name here && thanks for contribution :) # this code uses GPL V3 LICENSE ## check license it https://github.com/JymPatel/Python-FirstEdition/blob/Main/LICENSE print("this code uses GPL V3 LICENSE") print("") # start of code # import library import pic...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/video-operations/timelapse.py
video-operations/timelapse.py
# author : Avee Chakraborty # Department of software engineering, Diu # Bangladesh import cv2 capture = cv2.VideoCapture(0) fourcc = cv2.VideoWriter_fourcc(*"XVID") output = cv2.VideoWriter("timelapse.mp4", fourcc, 30, (640, 480)) while True: ret, frame = capture.read() output.write(frame) cv2.imshow("f...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/video-operations/slow-motion.py
video-operations/slow-motion.py
# author : Avee Chakraborty # Department of software engineering, Diu # Bangladesh import cv2 capture = cv2.VideoCapture(0) fourcc = cv2.VideoWriter_fourcc(*"XVID") output = cv2.VideoWriter("slowmotion.mp4", fourcc, 5, (640, 480)) while True: ret, frame = capture.read() output.write(frame) cv2.imshow("fr...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Test-Case-Generator/test_case.py
Test-Case-Generator/test_case.py
# ------------------------------------------------- ### # ------------------------------------------------- ### # ### Developed by TANMAY KHANDELWAL (aka Dude901). ### # _________________________________________________ ### # _________________________________________________ ### from tkinter import * from random ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nasa_apod_with_requests/run.py
nasa_apod_with_requests/run.py
from settings import key import requests import os date = input("Enter date(YYYY-MM-DD): ") r = requests.get(f"https://api.nasa.gov/planetary/apod?api_key={key}&date={date}") parsed = r.json() title = parsed["title"] url = parsed["hdurl"] print(f"{title}: {url}") img_ = requests.get(url, stream=True) print(img_.heade...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nasa_apod_with_requests/settings.py
nasa_apod_with_requests/settings.py
key = ""
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Tic-Tac-Toe Games/tic-tac-toe4.py
Tic-Tac-Toe Games/tic-tac-toe4.py
""" Tic-Tac-Toe Game using NumPy and random moves. Two players (1 and 2) randomly take turns until one wins or board is full. Doctests: >>> b = create_board() >>> all(b.flatten() == 0) True >>> len(possibilities(b)) 9 >>> row_win(np.array([[1,1,1],[0,0,0],[0,0,0]]), 1) True >>> col_win(np.array([[2,0,0],[2,0,0],[2,0...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Tic-Tac-Toe Games/tic-tac-toe2.py
Tic-Tac-Toe Games/tic-tac-toe2.py
""" Tic-Tac-Toe Console Game Two players (X and O) take turns to mark a 3x3 grid until one wins or the game ends in a draw. Doctest Examples: >>> test_board = [" "] * 10 >>> check_position(test_board, 1) True >>> test_board[1] = "X" >>> check_position(test_board, 1) False """ import os import time from typing impor...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Tic-Tac-Toe Games/tic-tac-toe6.py
Tic-Tac-Toe Games/tic-tac-toe6.py
""" Tic-Tac-Toe Series Game Two players can play multiple rounds of Tic-Tac-Toe. Keeps score across rounds until players quit. Doctest examples: >>> check_win({"X": [1, 2, 3], "O": []}, "X") True >>> check_win({"X": [1, 2], "O": []}, "X") False >>> check_draw({"X": [1, 2, 3], "O": [4, 5, 6]}) False >>> check_draw({"...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Tic-Tac-Toe Games/tic-tac-toe3.py
Tic-Tac-Toe Games/tic-tac-toe3.py
""" Tic-Tac-Toe with AI (Minimax) using CustomTkinter. Player = "X", AI = "O". Click a button to play. >>> check_winner([['X','X','X'],[' ',' ',' '],[' ',' ',' ']], 'X') True >>> check_winner([['X','O','X'],['O','O','O'],['X',' ',' ']], 'O') True >>> check_winner([['X','O','X'],['O','X','O'],['O','X','O']], 'X') Fals...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Tic-Tac-Toe Games/tic-tac-toe1.py
Tic-Tac-Toe Games/tic-tac-toe1.py
""" Text-based Tic-Tac-Toe (2 players). >>> check_winner([['X','X','X'],[' ',' ',' '],[' ',' ',' ']], 'X') True >>> check_winner([['X','O','X'],['O','O','O'],['X',' ',' ']], 'O') True >>> check_winner([['X','O','X'],['O','X','O'],['O','X','O']], 'X') False >>> is_full([['X','O','X'],['O','X','O'],['O','X','O']]) True ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Tic-Tac-Toe Games/tic-tac-toe5.py
Tic-Tac-Toe Games/tic-tac-toe5.py
""" Tic-Tac-Toe Game with Full Type Hints and Doctests. Two-player game where Player and Computer take turns. Player chooses X or O and Computer takes the opposite. Doctests examples: >>> is_winner([' ', 'X','X','X',' ',' ',' ',' ',' ',' '], 'X') True >>> is_space_free([' ', 'X',' ',' ',' ',' ',' ',' ',' ',' '], 1) ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Koch Curve/koch curve.py
Koch Curve/koch curve.py
# importing the libraries # turtle standard graphics library for python import turtle # function to create koch snowflake or koch curve def snowflake(lengthSide, levels): if levels == 0: t.forward(lengthSide) return lengthSide /= 3.0 snowflake(lengthSide, levels - 1) t.left(60) sno...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Recursion Visulaizer/recursionVisualizer.py
Recursion Visulaizer/recursionVisualizer.py
import turtle import random t = turtle.Turtle() num = random.randint(1, 1000) t.right(num) t.speed(num) t.left(num) def tree(i): if i < 10: return else: t.right(15) t.forward(15) t.left(20) t.backward(20) tree(2 * i / 5) t.left(2) tree(3 * i / 4...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Turn your PDFs into audio books/audiobook_gen.py
Turn your PDFs into audio books/audiobook_gen.py
import PyPDF2 import pyttsx3 book = open(input("Enter the book name: "), "rb") pg_no = int( input( "Enter the page number from which you want the system to start reading text: " ) ) pdf_Reader = PyPDF2.PdfFileReader(book) pages = pdf_Reader.numPages speaker = pyttsx3.init() for num in range((pg_no -...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/text-to-audio/text-file-to-audio.py
text-to-audio/text-file-to-audio.py
from gtts import gTTS import os # Enter the name of your text file mytextfile = "hello.txt" # Specify the language in which you want your audio language = "en" # Get the contents of your file with open(mytextfile, "r") as f: mytext = f.read() f.close() # Create an instance of gTTS class myobj = gTTS(text=my...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/text-to-audio/main.py
text-to-audio/main.py
from gtts import gTTS import os # Enter the text in string format which you want to convert to audio mytext = "Hello World!, this audio is created using GTTS module." # Specify the language in which you want your audio language = "en" # Create an instance of gTTS class myobj = gTTS(text=mytext, lang=language, slow=F...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Translator/translator.py
Translator/translator.py
from tkinter import * from translate import Translator # Translator function def translate(): translator = Translator(from_lang=lan1.get(), to_lang=lan2.get()) translation = translator.translate(var.get()) var1.set(translation) # Tkinter root Window with title root = Tk() root.title("Translator") # Cre...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Street_Fighter/src/fighter.py
Street_Fighter/src/fighter.py
import pygame class Fighter: def __init__(self, player, x, y, flip, data, sprite_sheet, animation_steps, sound): self.player = player self.size = data[0] self.image_scale = data[1] self.offset = data[2] self.flip = flip self.animation_list = self.load_images(sprite_...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Street_Fighter/src/main.py
Street_Fighter/src/main.py
import math import pygame from pygame import mixer import cv2 import numpy as np import os import sys from fighter import Fighter # Helper Function for Bundled Assets def resource_path(relative_path): try: base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/remoteok_jobs_scraper/remoteok_jobs.py
remoteok_jobs_scraper/remoteok_jobs.py
import requests import xlwt from xlwt import Workbook BASE_URL = 'https://remoteok.com/api' USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36' REQUEST_HEADER = { 'User-Agent': USER_AGENT, 'Accept-Language': 'en-US, en;q=0.5', } def ge...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/nodepad/notepad.py
nodepad/notepad.py
#! /usr/bin/env python # # GUI module generated by PAGE version 4.10 # In conjunction with Tcl version 8.6 # Jan 30, 2018 02:49:06 PM try: from Tkinter import * except ImportError: from tkinter import * try: import ttk py3 = 0 except ImportError: import tkinter.ttk as ttk py3 = 1 import ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/CountMillionCharacters-Variations/variation1.py
CountMillionCharacters-Variations/variation1.py
try: input = raw_input except NameError: pass def count_chars(filename): count = {} with open(filename) as info: # inputFile Replaced with filename readfile = info.read() for character in readfile.upper(): count[character] = count.get(character, 0) + 1 return count ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/very_easy/is_number.py
very_easy/is_number.py
# importing the module to check for all kinds of numbers truthiness in python. import numbers from math import pow from typing import Any # Assign values to author and version. __author__ = "Nitkarsh Chourasia" __version__ = "1.0.0" __date__ = "2023-08-24" def check_number(input_value: Any) -> str: """Check if i...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Downloaded Files Organizer/obs.py
Downloaded Files Organizer/obs.py
def watcher(path): # python script to observe changes in a folder import time import os from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler from move_to_directory import add_to_dir class Handler(FileSystemEventHandler): def on_created(self, eve...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Downloaded Files Organizer/move_to_directory.py
Downloaded Files Organizer/move_to_directory.py
import os import shutil ext = { "web": "css less scss wasm ", "audio": "aac aiff ape au flac gsm it m3u m4a mid mod mp3 mpa pls ra s3m sid wav wma xm ", "code": "c cc class clj cpp cs cxx el go h java lua m m4 php pl po py rb rs swift vb vcxproj xcodeproj xml diff patch html js ", "slide": "ppt odp ", ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Downloaded Files Organizer/browser_status.py
Downloaded Files Organizer/browser_status.py
import psutil from obs import watcher browsers = ["chrome.exe", "firefox.exe", "edge.exe", "iexplore.exe"] # ADD DOWNLOADS PATH HERE::: r is for raw string enter the path # Example: path_to_watch=r"C:\Users\Xyz\Downloads" # find downloads path . path_to_watch = r" " for browser in browsers: while browser in (...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Webbrowser/tk-browser.py
Webbrowser/tk-browser.py
#!/usr/bin/python3 # Webbrowser v1.0 # Written by Sina Meysami # from tkinter import * # pip install tk-tools import tkinterweb # pip install tkinterweb import sys class Browser(Tk): def __init__(self): super(Browser, self).__init__() self.title("Tk Browser") try: browser = ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/flappyBird_pygame/flappy_bird.py
flappyBird_pygame/flappy_bird.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 23 14:17:24 2019 @author: Mehul """ import math import os from collections import deque from random import randint import pygame from pygame.locals import * FPS = 60 ANI_SPEED = 0.18 # pixels per millisecond W_WIDTH = 284 * 2 # BG image size: ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Wikipdedia/flask_rendering.py
Wikipdedia/flask_rendering.py
from flask import Flask, render_template, request import practice_beautifulsoap as data app = Flask(__name__, template_folder="template") @app.route("/", methods=["GET", "POST"]) def index(): languages = data.lang() return render_template("index.html", languages=languages) @app.route("/display", methods=["...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Wikipdedia/practice_beautifulsoap.py
Wikipdedia/practice_beautifulsoap.py
from bs4 import BeautifulSoup import requests language_symbols = {} def lang(): try: response = requests.get("https://www.wikipedia.org/") response.raise_for_status() soup = BeautifulSoup(response.content, "html.parser") for option in soup.find_all("option"): language...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Wikipdedia/main.py
Wikipdedia/main.py
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. def print_hi(name): # Use a breakpoint in the code line below to debug your script. print(f"Hi, {name}") # Press ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Emoji Dictionary/emoji_dictionary.py
Emoji Dictionary/emoji_dictionary.py
# Emoji Dictionary # ----------------------------------------------------------------------------------------------------- from tkinter import * # importing the necessary libraries import tkinter.messagebox as mbox import tkinter as tk # imported tkinter as tk import emoji # ----------------------------------------...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Emoji Dictionary/QT_GUI.py
Emoji Dictionary/QT_GUI.py
# -*- coding: utf-8 -*- import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5 import uic from emoji import demojize import os class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() # Load the UI file uic.lo...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/brickout-game/brickout-game.py
brickout-game/brickout-game.py
""" Pygame base template for opening a window Sample Python/Pygame Programs Simpson College Computer Science http://programarcadegames.com/ http://simpson.edu/computer-science/ Explanation video: http://youtu.be/vRB_983kUMc ------------------------------------------------- Author for the Brickout game is Chri...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/AutoComplete_App/backend.py
AutoComplete_App/backend.py
import sqlite3 import json class AutoComplete: """ It works by building a `WordMap` that stores words to word-follower-count ---------------------------- e.g. To train the following statement: It is not enough to just know how tools work and what they worth, we have got to learn how to use th...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/AutoComplete_App/frontend.py
AutoComplete_App/frontend.py
from tkinter import * import backend def train(): sentence = train_entry.get() ac = backend.AutoComplete() ac.train(sentence) def predict_word(): word = predict_word_entry.get() ac = backend.AutoComplete() print(ac.predict(word)) if __name__ == "__main__": root = Tk() root.title("I...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/local_weighted_learning/local_weighted_learning.py
local_weighted_learning/local_weighted_learning.py
# Required imports to run this file import matplotlib.pyplot as plt import numpy as np # weighted matrix def weighted_matrix(point: np.mat, training_data_x: np.mat, bandwidth: float) -> np.mat: """ Calculate the weight for every point in the data set. It takes training_point , query_point, and tau Her...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/numberguessinggame/index.py
numberguessinggame/index.py
import random def number_guessing_game(): secret_number = random.randint(1, 100) attempts = 0 print("Welcome to the Number Guessing Game!") print("I'm thinking of a number between 1 and 100.") while True: try: guess = int(input("Your guess: ")) attempts += 1 ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/JARVIS/JARVIS_2.0.py
JARVIS/JARVIS_2.0.py
######### __author__ = "Mohammed Shokr <mohammedshokr2014@gmail.com>" __version__ = "v 0.1" """ JARVIS: - Control windows programs with your voice """ # import modules import datetime # datetime module supplies classes for manipulating dates and times import subprocess # subprocess module allows you to spawn new p...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/email id dictionary/dict1.py
email id dictionary/dict1.py
#!/usr/bin/env python counts = dict() mails = list() fname = input("Enter file name:") fh = open(fname) for line in fh: if not line.startswith("From "): continue # if line.startswith('From:'): # continue id = line.split() mail = id[1] mails.append(mail) freq_mail = max(mails, k...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Extract-Table-from-pdf-txt-docx/main.py
Extract-Table-from-pdf-txt-docx/main.py
# %% import pandas as pd import os import tabula from docx.api import Document # %% if os.path.isdir("Parent") == True: os.chdir("Parent") # FOR CHILD1 DIRECTORY if os.path.isdir("Child1") == True: os.chdir("Child1") # PDF FILE READING if os.path.isfile("Pdf1_Child1.pdf") == True: df_pdf_child1 = tabula.r...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle binary/update2.py
1 File handle/File handle binary/update2.py
# Updating records in a binary file # ! Have a .env file please import pickle import os from dotenv import load_dotenv base = os.path.dirname(__file__) load_dotenv(os.path.join(base, ".env")) student_record = os.getenv("STUDENTS_RECORD_FILE") def update(): with open(student_record, "rb") as F: S = pickle...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle binary/delete.py
1 File handle/File handle binary/delete.py
import logging import os import pickle from dotenv import load_dotenv base = os.path.dirname(__file__) load_dotenv(os.path.join(base, ".env")) logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") student_record = os.getenv("STUDENTS_RECORD_FILE") def b_read(): # Opening a file & loading...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle binary/search record in binary file.py
1 File handle/File handle binary/search record in binary file.py
# binary file to search a given record import pickle from dotenv import load_dotenv def search(): with open("student_records.pkl", "rb") as F: # your file path will be different search = True rno = int(input("Enter the roll number of the student")) for i in pickle.load(F): ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle binary/Update a binary file2.py
1 File handle/File handle binary/Update a binary file2.py
# updating records in a binary file import pickle def update(): with open("studrec.dat", "rb+") as File: value = pickle.load(File) found = False roll = int(input("Enter the roll number of the record")) for i in value: if roll == i[0]: print(f"current n...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle binary/question 1 (elegible for remedial, top marks).py
1 File handle/File handle binary/question 1 (elegible for remedial, top marks).py
"""Amit is a monitor of class XII-A and he stored the record of all the students of his class in a file named “student_records.pkl”. Structure of record is [roll number, name, percentage]. His computer teacher has assigned the following duty to Amit Write a function remcount( ) to count the number of students who need...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle binary/read.py
1 File handle/File handle binary/read.py
import pickle def binary_read(): with open("studrec.dat", "rb") as b: stud = pickle.load(b) print(stud) # prints the whole record in nested list format print("contents of binary file") for ch in stud: print(ch) # prints one of the chosen rec in list ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/special symbol after word.py
1 File handle/File handle text/special symbol after word.py
with open("happy.txt", "r") as F: # method 1 for i in F.read().split(): print(i, "*", end="") print("\n") # method 2 F.seek(0) for line in F.readlines(): for word in line.split(): print(word, "*", end="")
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/counter.py
1 File handle/File handle text/counter.py
""" Class resposible for counting words for different files: - Reduce redundant code - Easier code management/debugging - Code readability """ class Counter: def __init__(self, text: str) -> None: self.text = text # Define the initial count of the lower and upper case. self.count_lower = ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/question 5.py
1 File handle/File handle text/question 5.py
"""Write a function in python to count the number of lowercase alphabets present in a text file “happy.txt""" import time import os from counter import Counter print( "You will see the count of lowercase, uppercase and total count of alphabets in provided file.." ) file_path = input("Please, Enter file path: ")...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/input,output and error streams.py
1 File handle/File handle text/input,output and error streams.py
# practicing with streams import sys sys.stdout.write("Enter the name of the file") file = sys.stdin.readline() with open( file.strip(), ) as F: while True: ch = F.readlines() for i in ch: # ch is the whole file,for i in ch gives lines, for j in i gives letters,for j in i.split gives words ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/file handle 12 length of line in text file.py
1 File handle/File handle text/file handle 12 length of line in text file.py
import os import time file_name = input("Enter the file name to create:- ") print(file_name) def write_to_file(file_name): if os.path.exists(file_name): print(f"Error: {file_name} already exists.") return with open(file_name, "a") as F: while True: text = input("enter an...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/question 2.py
1 File handle/File handle text/question 2.py
"""Write a method/function DISPLAYWORDS() in python to read lines from a text file STORY.TXT, using read function and display those words, which are less than 4 characters.""" print("Hey!! You can print the word which are less then 4 characters") def display_words(file_path): try: with open(file_path) ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/question 6.py
1 File handle/File handle text/question 6.py
"""Write a function in python to count the number of lowercase alphabets present in a text file “happy.txt”""" from counter import Counter def lowercase(): with open("happy.txt") as F: word_counter = Counter(F.read()) print( f"The total number of lower case letters are {word_counter....
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/1 File handle/File handle text/question3.py
1 File handle/File handle text/question3.py
"""Write a user-defined function named count() that will read the contents of text file named “happy.txt” and count the number of lines which starts with either “I‟ or “M‟.""" import os import time file_name = input("Enter the file name to create:- ") # step1: print(file_name) def write_to_file(file_name): if ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/Word_Dictionary/dictionary.py
Word_Dictionary/dictionary.py
from typing import Dict, List class Dictionary: def __init__(self): self.node = {} def add_word(self, word: str) -> None: node = self.node for ltr in word: if ltr not in node: node[ltr] = {} node = node[ltr] node["is_word"] = True d...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/file_handle/File handle binary/update2.py
file_handle/File handle binary/update2.py
import pickle import os from dotenv import load_dotenv base = os.path.dirname(__file__) load_dotenv(os.path.join(base, ".env")) student_record = os.getenv("STUDENTS_RECORD_FILE") def update(): with open(student_record, "rb") as F: S = pickle.load(F) found = False rno = int(input("enter th...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/file_handle/File handle binary/delete.py
file_handle/File handle binary/delete.py
import logging import os import pickle from dotenv import load_dotenv base = os.path.dirname(__file__) load_dotenv(os.path.join(base, ".env")) logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") student_record = os.getenv("STUDENTS_RECORD_FILE") def b_read(): # Opening a file & loading...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/file_handle/File handle binary/search record in binary file.py
file_handle/File handle binary/search record in binary file.py
# binary file to search a given record import pickle from dotenv import load_dotenv def search(): with open("student_records.pkl", "rb") as F: # your file path will be different search = True rno = int(input("Enter the roll number of the student")) for i in pickle.load(F): ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/file_handle/File handle binary/Update a binary file2.py
file_handle/File handle binary/Update a binary file2.py
# updating records in a binary file import pickle import os base = os.path.dirname(__file__) from dotenv import load_dotenv load_dotenv(os.path.join(base, ".env")) student_record = os.getenv("STUDENTS_RECORD_FILE") ## ! Understand how pandas works internally def update(): with open(student_record, "rb") as Fi...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/file_handle/File handle binary/question 1 (elegible for remedial, top marks).py
file_handle/File handle binary/question 1 (elegible for remedial, top marks).py
"""Amit is a monitor of class XII-A and he stored the record of all the students of his class in a file named “student_records.pkl”. Structure of record is [roll number, name, percentage]. His computer teacher has assigned the following duty to Amit Write a function remcount( ) to count the number of students who need...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/file_handle/File handle binary/read.py
file_handle/File handle binary/read.py
import pickle def binary_read(): with open("studrec.dat", "rb") as b: stud = pickle.load(b) print(stud) # prints the whole record in nested list format print("contents of binary file") for ch in stud: print(ch) # prints one of the chosen rec in list ...
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false
geekcomputers/Python
https://github.com/geekcomputers/Python/blob/21cbdf223aadd1c28293570d1106fe47af6e9434/file_handle/File handle text/special symbol after word.py
file_handle/File handle text/special symbol after word.py
with open("happy.txt", "r") as F: # method 1 for i in F.read().split(): print(i, "*", end="") print("\n") # method 2 F.seek(0) for line in F.readlines(): for word in line.split(): print(word, "*", end="")
python
MIT
21cbdf223aadd1c28293570d1106fe47af6e9434
2026-01-04T14:42:18.827821Z
false