From aa6e7c0fa63a23251e7eb14a81cc9383079436c5 Mon Sep 17 00:00:00 2001 From: xavierfingers Date: Tue, 28 Oct 2025 16:56:20 -0600 Subject: [PATCH] Made some changes. --- MySQL_Databses.py | 9 +++++---- WeatherGUI.py | 4 ---- Web Socket.py | 1 - billing.py | 5 ++--- calc_area.py | 3 --- mapit.py | 1 - new.py | 10 ++-------- passwordGen.py | 7 ++----- sendemail.py | 3 --- sensors_information.py | 4 ---- sqlite_check.py | 1 - vowel remover function.py | 2 -- wikipedia.py | 5 ----- youtubedownloader.py | 6 ------ 14 files changed, 11 insertions(+), 50 deletions(-) diff --git a/MySQL_Databses.py b/MySQL_Databses.py index b9148ab708f..226a20e742c 100644 --- a/MySQL_Databses.py +++ b/MySQL_Databses.py @@ -1,12 +1,13 @@ import mysql.connector - # MySQl databses details - +host = input("Enter MySQL host: ") +username = input("Enter MySQL username: ") +password = input("Enter MySQL password: ") +db_name = input("Enter MySQL database: ") mydb = mysql.connector.connect( - host="0.0.0.0", user="root", passwd="", database="db_name" + host=host, user=username, passwd=password, database=db_name ) mycursor = mydb.cursor() - # Execute SQL Query =>>>> mycursor.execute("SQL Query") mycursor.execute("SELECT column FROM table") diff --git a/WeatherGUI.py b/WeatherGUI.py index 19b42994b84..62a2fef6bf8 100644 --- a/WeatherGUI.py +++ b/WeatherGUI.py @@ -1,14 +1,10 @@ import tkinter as tk import requests from bs4 import BeautifulSoup - url = "https://weather.com/en-IN/weather/today/l/32355ced66b7ce3ab7ccafb0a4f45f12e7c915bcf8454f712efa57474ba8d6c8" - root = tk.Tk() root.title("Weather") root.config(bg="white") - - def getWeather(): page = requests.get(url) soup = BeautifulSoup(page.content, "html.parser") diff --git a/Web Socket.py b/Web Socket.py index 8da7e224c00..9c3c91beafa 100644 --- a/Web Socket.py +++ b/Web Socket.py @@ -1,6 +1,5 @@ # Program to print a data & it's Metadata of online uploaded file using "socket". import socket - skt_c = socket.socket(socket.AF_INET, socket.SOCK_STREAM) skt_c.connect(("data.pr4e.org", 80)) link = "GET http://data.pr4e.org/intro-short.txt HTTP/1.0\r\n\r\n".encode() diff --git a/billing.py b/billing.py index c0368a18e49..451135cc91c 100644 --- a/billing.py +++ b/billing.py @@ -1,4 +1,4 @@ -updated_billing + items = {"apple": 5, "soap": 4, "soda": 6, "pie": 7, "cake": 20} total_price = 0 try: @@ -10,7 +10,7 @@ Press 5 for cake Press 6 for bill""") while True: - choice = int(input("enter your choice here..\n")) + choice = int(input("enter your choice here..")) if choice == 1: print("Apple added to the cart") total_price += items["apple"] @@ -37,7 +37,6 @@ print("Please enter the digits within the range 1-6..") except: print("enter only digits") - """ Code Explanation: A dictionary named items is created to store product names and their corresponding prices. diff --git a/calc_area.py b/calc_area.py index cf7f259e046..29fb370cd4a 100644 --- a/calc_area.py +++ b/calc_area.py @@ -1,8 +1,6 @@ # Author: PrajaktaSathe # Program to calculate the area of - square, rectangle, circle, and triangle - import math as m - - def main(): shape = int( input( @@ -38,7 +36,6 @@ def main(): print("You have selected wrong choice.") restart = input("Would you like to calculate the area of another object? Y/N : ") - if restart.lower().startswith("y"): main() elif restart.lower().startswith("n"): diff --git a/mapit.py b/mapit.py index 73d8666d7b7..27fb71a92fc 100644 --- a/mapit.py +++ b/mapit.py @@ -1,7 +1,6 @@ import sys import webbrowser import pyperclip - if len(sys.argv) > 1: address = " ".join(sys.argv[1:]) diff --git a/new.py b/new.py index 5a5f623242c..c5058551ec7 100644 --- a/new.py +++ b/new.py @@ -1,9 +1,3 @@ -def hello_world(): - """ - Prints a greeting message. - """ - print("Hello, world!") - -if __name__ == "__main__": - hello_world() +print("Hello, world!") + diff --git a/passwordGen.py b/passwordGen.py index b05990decc2..56ab3b462a1 100644 --- a/passwordGen.py +++ b/passwordGen.py @@ -1,12 +1,9 @@ import random - lChars = "abcdefghijklmnopqrstuvwxyz" uChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" digits = "1234567890" -specialChars = "!@#$%^&*-_+=" - +specialChars = "!@#$%^&*-_+=()[]" myPass = "" - # Generate 3 lowercase letters for _ in range(3): myPass += random.choice(lChars) @@ -23,4 +20,4 @@ for _ in range(2): myPass += random.choice(uChars) -print(myPass) # Output: 10-character password (e.g. "abc123!@AB") +print(myPass) diff --git a/sendemail.py b/sendemail.py index 12a01080ee7..070968157be 100644 --- a/sendemail.py +++ b/sendemail.py @@ -1,5 +1,4 @@ from __future__ import print_function - import base64 import mimetypes import os @@ -17,8 +16,6 @@ SCOPES = "https://www.googleapis.com/auth/gmail.send" CLIENT_SECRET_FILE = "client_secret.json" APPLICATION_NAME = "Gmail API Python Send Email" - - def get_credentials(): home_dir = os.path.expanduser("~") credential_dir = os.path.join(home_dir, ".credentials") diff --git a/sensors_information.py b/sensors_information.py index 0a233f26ab4..257b41e5a4b 100644 --- a/sensors_information.py +++ b/sensors_information.py @@ -2,12 +2,8 @@ import sys import socket import psutil - - def python_version(): return sys.version_info - - def ip_addresses(): hostname = socket.gethostname() addresses = socket.getaddrinfo(hostname, None) diff --git a/sqlite_check.py b/sqlite_check.py index 295274f8539..27e35ace641 100644 --- a/sqlite_check.py +++ b/sqlite_check.py @@ -1,5 +1,4 @@ from __future__ import print_function - import os import sqlite3 as lite import sys diff --git a/vowel remover function.py b/vowel remover function.py index 8d6467b57dc..5af2ff5f01e 100644 --- a/vowel remover function.py +++ b/vowel remover function.py @@ -4,6 +4,4 @@ def vowel_remover(text): if l.lower() not in "aeiou": string += l return string - - print(vowel_remover("hello world!")) diff --git a/wikipedia.py b/wikipedia.py index dd7a5f05321..7235894b66c 100644 --- a/wikipedia.py +++ b/wikipedia.py @@ -1,19 +1,14 @@ import wikipedia from tkinter import * from tkinter.messagebox import showinfo - win = Tk() # objek win.title("WIKIPEDIA") win.geometry("200x70") # function - - # function def search_wiki(): search = entry.get() Hasil = wikipedia.summary(search) showinfo("Hasil Pencarian", Hasil) - - label = Label(win, text="Wikipedia Search :") label.grid(row=0, column=0) diff --git a/youtubedownloader.py b/youtubedownloader.py index fdcbe89fed3..b5667950a27 100644 --- a/youtubedownloader.py +++ b/youtubedownloader.py @@ -1,14 +1,10 @@ from tkinter import Button, Entry, Label, Tk, filedialog, messagebox from threading import Thread from pytube import YouTube - - def threading(): # Call work function t1 = Thread(target=download) t1.start() - - def download(): try: url = YouTube(str(url_box.get())) @@ -30,7 +26,6 @@ def download(): root.geometry("780x500+200+200") root.configure(bg="olivedrab1") root.resizable(False, False) - # Label widgets introlable = Label( root, @@ -52,5 +47,4 @@ def download(): btn = Button(root, text="DOWNLOAD", font=("sans-serif", 25), command=threading) btn.place(x=270, y=240) - root.mainloop()