initial commit

This commit is contained in:
hoffmeisterda104361 committed 2026-10-19 20:29:13 +02:00
commit 39f56a3b10
83 files changed
+3583

No files matched your search

+108
View File
@@ -0,0 +1,108 @@
import tkinter as tk
from my_package.App_window import AppWindow
def is_valid_isbn(entry):
clean_isbn = entry.replace("-", "").replace(" ", "").upper()
if len(clean_isbn) != 10:
return False
total = 0
try:
for i in range(10):
char = clean_isbn[i]
if i == 9 and char == 'X':
value = 10
elif char.isdigit():
value = int(char)
else:
return False
total += value * (10 - i)
return total % 11 == 0
except Exception:
return False
def is_valid_iban(entry):
clean_iban = entry.replace(" ", "").upper()
rearranged = clean_iban[4:] + clean_iban[:4]
numeric_iban = ""
for char in rearranged:
if char.isdigit():
numeric_iban += char
else:
numeric_iban += str(ord(char) - 55)
return int(numeric_iban) % 97 == 1
class Checker(AppWindow):
def __init__(self):
super().__init__(300,300)
self.button_1 = tk.Button(self.root, text="check", command= self.check_isbn)
self.button_2 = tk.Button(self.root,text="check", command= self.check_iban)
self.isbn_label = tk.Label(self.root, text="")
self.iban_label = tk.Label(self.root, text="")
self.entry_1 = tk.Entry(self.root, width=20)
self.entry_2 = tk.Entry(self.root, width=20)
def init_widgets(self):
tk.Label(self.root, text="ISBN: ").grid(row=0, column=0)
self.entry_1.grid(row=0, column=1)
self.button_1.grid(row=1, column=0)
self.isbn_label.grid(row=1, column=1)
tk.Label(self.root, text="IBAN: ").grid(row=2, column=0)
self.entry_2.grid(row=2, column=1)
self.button_2.grid(row=3, column=0)
self.iban_label.grid(row=3, column=1)
def check_isbn(self):
entry = self.entry_1.get()
self.entry_1.delete(0, tk.END)
if is_valid_isbn(entry):
self.isbn_label.configure(text="Valid ISBN")
else:
self.isbn_label.configure(text="Invalid ISBN")
def check_iban(self):
entry = self.entry_2.get()
self.entry_2.delete(0, tk.END)
if is_valid_iban(entry):
self.iban_label.configure(text="Valid IBAN")
else:
self.iban_label.configure(text="Invalid IBAN")
def console_checker():
print("Welcome to IBAN / ISBN Checker")
while True:
usr_input = input("Please enter your Number: ")
print("1. Check ISBN")
print("2. Check IBAN")
print("3. Exit")
usr_choice = input("1 / 2 / 3 ?: ")
if usr_choice == "1":
if is_valid_isbn(usr_input):
print("Valid ISBN")
else:
print("Invalid ISBN")
if usr_choice == "2":
if is_valid_iban(usr_input):
print("Valid IBAN")
else:
print("Invalid IBAN")
if usr_choice == "3":
break
def main():
app = Checker()
app.run()
console_checker()
+38
View File
@@ -0,0 +1,38 @@
import tkinter as tk
from my_package.App_window import AppWindow
class VowelDelete (AppWindow):
def __init__(self):
super().__init__(300,300)
self.vowels = ['a', 'e', 'i', 'o', 'u']
self.button = tk.Button(self.root, text="decompose", command=self.on_click)
self.label = tk.Label(self.root, text="enter text: ")
self.entry = tk.Entry(self.root, width=20)
self.list = tk.Listbox(self.root)
def init_widgets(self):
self.label.grid(row=0, column=0)
self.entry.grid(row=0, column=1)
self.button.grid(row=1, column=0)
self.list.grid(row=1, column=1)
def on_click(self):
entry = self.entry.get()
self.entry.delete(tk.END)
entry_split = list(entry)
c_entry_split = entry_split.copy()
for vowel in c_entry_split:
if vowel in self.vowels:
entry_split.remove(vowel)
result = ''.join(entry_split)
self.list.insert(tk.END, str(result))
def main():
app = VowelDelete()
app.run()
main()