init all
This commit is contained in:
1 parent
3ccae7daa6
commit
59cda27092
18 files changed
+410
No files matched your search
@@ -0,0 +1,16 @@
|
||||
formats = {
|
||||
'1': 'Standartbrief',
|
||||
'2': 'Kompaktbrief',
|
||||
'3': 'Großbrief',
|
||||
'4': 'Maxibrief',
|
||||
'5': 'Postkarte',
|
||||
}
|
||||
|
||||
weights = [
|
||||
{'g20': '0.95',},
|
||||
]
|
||||
|
||||
# format = input("Format: ")
|
||||
# weight = float(input("Weight: "))
|
||||
|
||||
print(formats['1'])
|
||||
@@ -0,0 +1 @@
|
||||
print("Hallo Welt")
|
||||
@@ -0,0 +1,10 @@
|
||||
Radikant = float(input("Radikant eingeben: "))
|
||||
|
||||
x = 5
|
||||
while True:
|
||||
Wurzel = 0.5 * (x + Radikant /x)
|
||||
x = Wurzel
|
||||
if abs(Wurzel * Wurzel - Radikant) < 0.000001:
|
||||
break
|
||||
|
||||
print("Die Quadratwurzel von {0:.2f} = {1:.6f}\n".format(Radikant, Wurzel))
|
||||
@@ -0,0 +1,57 @@
|
||||
def wechselgeld_rechner(preis, gezahlt):
|
||||
# Überprüfen, ob der gezahlte Betrag kleiner als der Preis ist
|
||||
# In diesem Fall ist kein Wechselgeld möglich
|
||||
if gezahlt < preis:
|
||||
return "Der Betrag, der gegeben wurde, ist geringer als der Preis."
|
||||
|
||||
# Berechnung des Wechselgeldes (auf zwei Nachkommastellen gerundet)
|
||||
wechselgeld = round(gezahlt - preis, 2)
|
||||
|
||||
# Dictionary mit allen verfügbaren Geldstücken/Scheinen und ihrer anfänglichen Anzahl (0)
|
||||
geldwerte = {
|
||||
50: 0,
|
||||
20: 0,
|
||||
10: 0,
|
||||
5: 0,
|
||||
2: 0,
|
||||
1: 0,
|
||||
0.5: 0,
|
||||
0.2: 0,
|
||||
0.1: 0,
|
||||
0.05: 0,
|
||||
0.02: 0,
|
||||
0.01: 0
|
||||
}
|
||||
|
||||
# Berechnung, wie viele Stücke eines jeden Geldwerts benötigt werden
|
||||
for wert in sorted(geldwerte.keys(), reverse=True):
|
||||
# Prüfen, ob der aktuelle Geldwert in das verbleibende Wechselgeld passt
|
||||
if wechselgeld >= wert:
|
||||
# Anzahl bestimmen durch ganzzahlige Division
|
||||
anzahl = int(wechselgeld // wert)
|
||||
geldwerte[wert] = anzahl
|
||||
|
||||
# Verbleibendes Wechselgeld reduzieren
|
||||
wechselgeld -= anzahl * wert
|
||||
|
||||
# Nach jeder Berechnung erneut runden, um Fließkommafehler zu vermeiden
|
||||
wechselgeld = round(wechselgeld, 2)
|
||||
|
||||
# Zurückgeben eines Dictionaries, das nur Einträge enthält, die tatsächlich ausgegeben werden
|
||||
return {k: v for k, v in geldwerte.items() if v > 0}
|
||||
|
||||
# Benutzerabfrage für Preis und gezahlten Betrag
|
||||
preis = float(input("Preis: "))
|
||||
gezahlt = float(input("Gezahlt: "))
|
||||
|
||||
# Aufruf der Funktion
|
||||
wechselgeld = wechselgeld_rechner(preis, gezahlt)
|
||||
|
||||
# Ausgabe des gesamten Wechselgeldes
|
||||
print(f"Wechselgeld: {gezahlt - preis:.2f} Euro")
|
||||
|
||||
# Ausgabe der einzelnen Geldstücke
|
||||
print("Ausgegeben in folgenden Werten:")
|
||||
for wert, anzahl in wechselgeld.items():
|
||||
if anzahl > 0:
|
||||
print(f"{anzahl} x {wert:.2f} Euro")
|
||||
@@ -0,0 +1,32 @@
|
||||
def setData():
|
||||
kreditbetrag = float(input("Kreditbetrag: "))
|
||||
monatsrate = float(input("Monatsrate: "))
|
||||
nominalzins = float(input("Nominalzins (%): "))
|
||||
|
||||
return kreditbetrag, monatsrate, nominalzins
|
||||
|
||||
def calculate(kreditbetrag, monatsrate, nominalzins):
|
||||
monate = 0
|
||||
summezinsen = 0
|
||||
restkredit = kreditbetrag
|
||||
|
||||
while restkredit > 0:
|
||||
monatszins = (restkredit * (nominalzins / 100)) / 12
|
||||
tilgung = monatsrate - monatszins
|
||||
restkredit -= tilgung
|
||||
summezinsen += monatszins
|
||||
monate += 1
|
||||
|
||||
return monate, summezinsen
|
||||
|
||||
|
||||
def output(monate, summezinsen):
|
||||
print("")
|
||||
print("Laufzeit in Monaten:", monate)
|
||||
print("Laufzeit:", monate // 12, "Jahre und", monate % 12, "Monate")
|
||||
print("Gezahlte Zinsen:", round(summezinsen, 2))
|
||||
|
||||
if __name__ == "__main__":
|
||||
kreditbetrag, monatsrate, nominalzins = setData()
|
||||
monate, summezinsen = calculate(kreditbetrag, monatsrate, nominalzins)
|
||||
output(monate, summezinsen)
|
||||
@@ -0,0 +1,54 @@
|
||||
import tkinter as tk
|
||||
from tkinter import messagebox
|
||||
|
||||
def calculate(kreditbetrag, monatsrate, nominalzins):
|
||||
monate = 0
|
||||
summezinsen = 0
|
||||
restkredit = kreditbetrag
|
||||
|
||||
while restkredit > 0:
|
||||
monatszins = (restkredit * (nominalzins / 100)) / 12
|
||||
tilgung = monatsrate - monatszins
|
||||
|
||||
restkredit -= tilgung
|
||||
summezinsen += monatszins
|
||||
monate += 1
|
||||
|
||||
return monate, summezinsen
|
||||
|
||||
|
||||
def start_calculation():
|
||||
kreditbetrag = float(entry_kreditbetrag.get())
|
||||
monatsrate = float(entry_monatsrate.get())
|
||||
nominalzins = float(entry_nominalzins.get())
|
||||
|
||||
monate, summezinsen = calculate(kreditbetrag, monatsrate, nominalzins)
|
||||
|
||||
label_ergebnis.config(
|
||||
text=f"Laufzeit: {monate} Monate\n"
|
||||
f"({monate // 12} Jahre und {monate % 12} Monate)\n"
|
||||
f"Gezahlte Zinsen: {round(summezinsen, 2)} €"
|
||||
)
|
||||
|
||||
root = tk.Tk()
|
||||
root.title("Kreditrechner")
|
||||
root.geometry("350x350")
|
||||
|
||||
tk.Label(root, text="Kreditbetrag (€):").pack(pady=5)
|
||||
entry_kreditbetrag = tk.Entry(root)
|
||||
entry_kreditbetrag.pack()
|
||||
|
||||
tk.Label(root, text="Monatsrate (€):").pack(pady=5)
|
||||
entry_monatsrate = tk.Entry(root)
|
||||
entry_monatsrate.pack()
|
||||
|
||||
tk.Label(root, text="Nominalzins (%):").pack(pady=5)
|
||||
entry_nominalzins = tk.Entry(root)
|
||||
entry_nominalzins.pack()
|
||||
|
||||
tk.Button(root, text="Berechnen", command=start_calculation).pack(pady=10)
|
||||
|
||||
label_ergebnis = tk.Label(root, text="", justify="left")
|
||||
label_ergebnis.pack(pady=10)
|
||||
|
||||
root.mainloop()
|
||||
@@ -0,0 +1,10 @@
|
||||
import math
|
||||
pi = math.pi
|
||||
|
||||
r = float(input("Radius (In cm): "))
|
||||
|
||||
umfang = 2 * pi * r
|
||||
flaeche = pi * r*r
|
||||
|
||||
print("Umfang: ", umfang)
|
||||
print("Fläche: ", flaeche)
|
||||
@@ -0,0 +1,19 @@
|
||||
import math
|
||||
|
||||
x = round(21.4444, 2)
|
||||
print(x)
|
||||
|
||||
h = float(input("Höhe: "))
|
||||
r = float(input("Radius: "))
|
||||
|
||||
V = 1/3 * math.pi * pow(r, 2) * h
|
||||
s = math.sqrt(pow(r, 2) * pow(h, 2))
|
||||
Ao = math.pi * r * (r + s)
|
||||
|
||||
rV = (round(V, 2))
|
||||
rs = (round(s, 2))
|
||||
rAo = (round(Ao, 2))
|
||||
|
||||
print("V:", rV)
|
||||
print("s:", rs)
|
||||
print("Ao:", rAo)
|
||||
@@ -0,0 +1,12 @@
|
||||
from math import pi
|
||||
|
||||
durchmesser = float(input("Durchmesser: "))
|
||||
radius = durchmesser / 2
|
||||
volumen = 4/3 * pi * pow(radius, 3)
|
||||
oberflaeche = 4 * pi * pow(radius, 2)
|
||||
|
||||
print()
|
||||
print("Radius", radius)
|
||||
print("Volumen", volumen)
|
||||
print("Oberfläche", oberflaeche)
|
||||
print()
|
||||
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"workbench.colorTheme": "Default Dark Modern",
|
||||
"editor.fontFamily": "'Fira Code', monospace",
|
||||
"editor.fontSize": 16,
|
||||
"editor.lineHeight": 1.5,
|
||||
"editor.letterSpacing": 0.5,
|
||||
"editor.tabSize": 2,
|
||||
"editor.renderWhitespace": "boundary",
|
||||
"editor.renderControlCharacters": true,
|
||||
"editor.minimap.enabled": false,
|
||||
"workbench.iconTheme": "vs-seti",
|
||||
"editor.cursorStyle": "line",
|
||||
"editor.cursorBlinking": "smooth",
|
||||
"editor.lineNumbers": "on",
|
||||
"editor.rulers": [80],
|
||||
"editor.wordWrap": "on",
|
||||
"files.autoSave": "onWindowChange",
|
||||
"files.autoSaveDelay": 1000,
|
||||
"window.zoomLevel": 0,
|
||||
"editor.snippetSuggestions": "top",
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/*.js.map": true
|
||||
},
|
||||
"terminal.integrated.fontFamily": "'Fira Code', monospace",
|
||||
"terminal.integrated.fontSize": 14,
|
||||
"workbench.colorCustomizations": {
|
||||
"editor.background": "#1e1e1e",
|
||||
"editor.foreground": "#d4d4d4",
|
||||
"editorCursor.foreground": "#ffcc00",
|
||||
"editor.lineHighlightBackground": "#2a2a2a",
|
||||
"editor.selectionBackground": "#3e3e3e",
|
||||
"editorWordHighlight.background": "#444444",
|
||||
"editorWordHighlightStrong.background": "#555555",
|
||||
"editor.findMatchBackground": "#d4d4d4",
|
||||
"editor.findMatchHighlightBackground": "#bd789fbb"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
zahlen = []
|
||||
|
||||
x = 1
|
||||
while True:
|
||||
zahlen.append(x)
|
||||
if (x >= 10):
|
||||
break
|
||||
x = x + 1
|
||||
|
||||
print(zahlen)
|
||||
@@ -0,0 +1,29 @@
|
||||
maxPoints = float(input("Max Points: "))
|
||||
reachedPoints = float(input("Reached Points: "))
|
||||
|
||||
percent = reachedPoints / maxPoints * 100
|
||||
|
||||
print(f"Percent {percent:.2f}")
|
||||
|
||||
notes = ["1", "2", "3", "4", "5", "6"]
|
||||
|
||||
wording = "Your Test Note:"
|
||||
|
||||
if percent < 30:
|
||||
print(wording, notes[5])
|
||||
|
||||
if percent >= 30 and percent < 50 :
|
||||
print(wording, notes[4])
|
||||
|
||||
if percent >= 50 and percent < 67 :
|
||||
print(wording, notes[3])
|
||||
|
||||
if percent >= 67 and percent < 81 :
|
||||
print(wording, notes[2])
|
||||
|
||||
if percent >= 81 and percent < 92 :
|
||||
print(wording, notes[1])
|
||||
|
||||
if percent >= 92:
|
||||
print(wording, notes[0])
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import math
|
||||
|
||||
print("Normalform: ax^2+bx+c")
|
||||
|
||||
a = float(input("a = "))
|
||||
b = float(input("b = "))
|
||||
c = float(input("c = "))
|
||||
|
||||
x1 = ((-b) - (math.sqrt(b*b - 4*a*c))) / (2*a)
|
||||
x2 = ((-b) + (math.sqrt(b*b - 4*a*c))) / (2*a)
|
||||
|
||||
print(f"x1 {x1}")
|
||||
print(f"x2 {x2}")
|
||||
@@ -0,0 +1,18 @@
|
||||
import random
|
||||
import time
|
||||
|
||||
zahlen = []
|
||||
anzahlElemente = 20000
|
||||
startTime = time.time()
|
||||
|
||||
for i in range(anzahlElemente):
|
||||
zahlen.append(random.randint(1, anzahlElemente-1))
|
||||
|
||||
print(f"Zufällige Zahlen : {zahlen}")
|
||||
print(f"Sortiert (aufsteigend) : {sorted(list(set(zahlen)))}")
|
||||
print(f"Sortiert (absteigend) : {sorted(set(zahlen), reverse=True)}")
|
||||
print(f"Kleinste Zahl : {min(zahlen)}")
|
||||
print(f"Größte Zahl : {max(zahlen)}")
|
||||
print(f"Anzahl Zahlen : {anzahlElemente}")
|
||||
print(f"Zeitmessung : {(time.time() - startTime):0.8f}")
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
class Calculate:
|
||||
def plus(num1, num2):
|
||||
return num1 + num2
|
||||
|
||||
def minus(num1, num2):
|
||||
return num1 - num2
|
||||
|
||||
def multiplication(num1, num2):
|
||||
return num1 * num2
|
||||
|
||||
def division(num1, num2):
|
||||
return num1 / num2
|
||||
|
||||
print()
|
||||
entries = ["Plus", "Minus", "Multiplication", "Division"]
|
||||
for entry in entries:
|
||||
print(entry)
|
||||
|
||||
|
||||
print()
|
||||
entry = input("What operation: ")
|
||||
print()
|
||||
|
||||
input1 = float(input("Number 1: "))
|
||||
input2 = float(input("Number 2: "))
|
||||
print()
|
||||
|
||||
match entry:
|
||||
case "Plus" | "plus" | "1":
|
||||
calculatedResult = Calculate.plus(input1, input2)
|
||||
case "Minus" | "minus" | "2":
|
||||
calculatedResult = Calculate.minus(input1, input2)
|
||||
case "Multiplication" | "multiplication" | "3":
|
||||
calculatedResult = Calculate.multiplication(input1, input2)
|
||||
case "Division" | "division" | "4":
|
||||
calculatedResult = Calculate.division(input1, input2)
|
||||
|
||||
print(f"Result: {calculatedResult:1.2f}")
|
||||
print()
|
||||
@@ -0,0 +1,18 @@
|
||||
import tkinter as tk
|
||||
|
||||
class App(tk.Frame):
|
||||
def __init__(self, master=None):
|
||||
super().__init__(master)
|
||||
self.pack()
|
||||
|
||||
# create the application
|
||||
myapp = App()
|
||||
|
||||
#
|
||||
# here are method calls to the window manager class
|
||||
#
|
||||
myapp.master.title("My Do-Nothing Application")
|
||||
myapp.master.maxsize(1000, 400)
|
||||
|
||||
# start the program
|
||||
myapp.mainloop()
|
||||
@@ -0,0 +1,11 @@
|
||||
# i = 1
|
||||
# while i <= 10:
|
||||
# print(i)
|
||||
# i = i + 1
|
||||
|
||||
nums = []
|
||||
|
||||
for i in range(0,100,5):
|
||||
nums.append(i)
|
||||
|
||||
print(nums)
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
name = "Max"
|
||||
alter = 25
|
||||
zahl = 1000000
|
||||
a = 5
|
||||
b = 3
|
||||
pi = 3.14159265
|
||||
text = f"Ich heiße {name} und bin {alter} Jahre alt."
|
||||
|
||||
print(f"|{name:<10}|") # linksbündig
|
||||
print(f"|{name:>10}|") # rechtsbündig
|
||||
print(f"|{name:^10}|") # zentriert
|
||||
print(f"{zahl:,}")
|
||||
print(f"Pi gerundet: {pi:.2f}")
|
||||
print(f"Die Summe ist {a + b}")
|
||||
print(text)
|
||||
Reference in new issue
Block a user