Compare commits
10 Commits
c580ecc6e4
...
master
Author | SHA1 | Date | |
---|---|---|---|
452659706e | |||
1fa3869c6c | |||
5368be695f | |||
9e928bbec7 | |||
9f5acc3f58 | |||
1c7f6684dc | |||
cf658c28dd | |||
c428658174 | |||
56fe3621c2 | |||
b9843e5485 |
34
2.Erste Programme/15. String Vergleich/Quiz.py
Normal file
34
2.Erste Programme/15. String Vergleich/Quiz.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
punkte=0
|
||||||
|
|
||||||
|
#Frage 1
|
||||||
|
korrekt="c"
|
||||||
|
print("Welchees ist die größte Wüste")
|
||||||
|
print("a-Gobi\nb-Sahra\nc-Antarktis\nd-Arktis")
|
||||||
|
|
||||||
|
antwort = str(input("Ihre Antwort:"))
|
||||||
|
#str sthet für String, also eine Zeichenkette aus einem oder mehreren Buchstaben
|
||||||
|
|
||||||
|
if antwort==korrekt:
|
||||||
|
print ('Die Antowrt: "%s" ist richtig.'%(antwort))
|
||||||
|
punkte=punkte+1
|
||||||
|
print("Sie haben jetzt %sPunkte."%(punkte))
|
||||||
|
else:
|
||||||
|
print ('Die Antwort: "%s" ist falsch.'%(antwort))
|
||||||
|
print("Sie haben jetzt %sPunkte."%(punkte))
|
||||||
|
|
||||||
|
|
||||||
|
#Frage 2
|
||||||
|
korrekt="c"
|
||||||
|
print("")
|
||||||
|
print("a-\nb-\nc-\nd-")
|
||||||
|
|
||||||
|
antwort = str(input("Ihre Antwort:"))
|
||||||
|
#str sthet für String, also eine Zeichenkette aus einem oder mehreren Buchstaben
|
||||||
|
|
||||||
|
if antwort==korrekt:
|
||||||
|
print ('Die Antowrt: "%s" ist richtig.'%(antwort))
|
||||||
|
punkte=punkte+1
|
||||||
|
print("Sie haben jetzt %sPunkte."%(punkte))
|
||||||
|
else:
|
||||||
|
print ('Die Antwort: "%s" ist falsch.'%(antwort))
|
||||||
|
print("Sie haben jetzt %sPunkte."%(punkte))
|
14
2.Erste Programme/15. String Vergleich/Quiz_Philipp.py
Normal file
14
2.Erste Programme/15. String Vergleich/Quiz_Philipp.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Make a programm which asks Quiz Questions, which are stored in a database
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
punkte=0
|
||||||
|
i=0
|
||||||
|
con = sqlite3.connect('questions.db')
|
||||||
|
cur = con.cursor()
|
||||||
|
# Fetch Questions
|
||||||
|
while(True):
|
||||||
|
i+1
|
||||||
|
question=cur.execute("SELECT QUESTION FROM QUESTIONS WHERE NUMBER is %s"%(i))
|
||||||
|
print(question)
|
||||||
|
break
|
||||||
|
# @Philipp: fortsetzen
|
BIN
2.Erste Programme/15. String Vergleich/questions.db
Normal file
BIN
2.Erste Programme/15. String Vergleich/questions.db
Normal file
Binary file not shown.
19
2.Erste Programme/16. Funktionen/Funktionen.py
Normal file
19
2.Erste Programme/16. Funktionen/Funktionen.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Programm, welches die Funktion(Programmierung) in Python einführt.
|
||||||
|
|
||||||
|
def summe(summand1,summand2): #Funktion Summe
|
||||||
|
return summand1+summand2
|
||||||
|
|
||||||
|
def potenz(basis,exponent): # Funktion Potenz
|
||||||
|
ergebnis=1
|
||||||
|
for i in range(exponent):
|
||||||
|
ergebnis=ergebnis*basis
|
||||||
|
|
||||||
|
return ergebnis
|
||||||
|
|
||||||
|
|
||||||
|
# Beginn des eigentlichen Hauptprogramms
|
||||||
|
|
||||||
|
print(summe(3,5))
|
||||||
|
print(summe(233,87))
|
||||||
|
|
||||||
|
print(potenz(2,3))
|
33
2.Erste Programme/3. BubbleSort Python/unterricht.py
Normal file
33
2.Erste Programme/3. BubbleSort Python/unterricht.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Programm, welches das Sortierverfahren Bubble-Sort mit hilfe eines Aarays durchführt.
|
||||||
|
|
||||||
|
array=[] # Leeren Array erstellen
|
||||||
|
# Nutzer fragen, wie lang der Array sein soll
|
||||||
|
arraylenght=int(input("Wie lang soll die Zahlenliste sein? "))
|
||||||
|
|
||||||
|
# Zahlen dem Array hinzufügen
|
||||||
|
for i in range(arraylenght):
|
||||||
|
neue_nummer=float(input("Bitte Nummer eingeben: "))
|
||||||
|
array.append(neue_nummer)
|
||||||
|
# Verarbeitung
|
||||||
|
|
||||||
|
'''
|
||||||
|
# 1. Version
|
||||||
|
if array[0]>array[1]: #Tausch, falls vordere Zahl größer
|
||||||
|
h=array[0] #Ringtausch
|
||||||
|
array[0]=array[1]
|
||||||
|
array[1]=h
|
||||||
|
'''
|
||||||
|
|
||||||
|
# 2. Version
|
||||||
|
for j in range(len(array)-1):
|
||||||
|
for i in range(len(array)-1):
|
||||||
|
if array[i]>array[i+1]: #Tausch, falls vordere Zahl größer
|
||||||
|
h=array[i] #Ringtausch
|
||||||
|
array[i]=array[i+1]
|
||||||
|
array[i+1]=h
|
||||||
|
|
||||||
|
|
||||||
|
# Ausgabe
|
||||||
|
print("Folgende Reihenfolge ergibt sich für %s Zahlen:" %(len(array)))
|
||||||
|
for i in range(len(array)):
|
||||||
|
print (array[i])
|
@ -22,6 +22,7 @@ def admin_mode():
|
|||||||
print("1. Add Product")
|
print("1. Add Product")
|
||||||
print("2. Change Price")
|
print("2. Change Price")
|
||||||
print("3. Delete Product")
|
print("3. Delete Product")
|
||||||
|
print("4. Quit Admin Mode")
|
||||||
# Ask for the user input
|
# Ask for the user input
|
||||||
admin_input=input("Please choose an option: ")
|
admin_input=input("Please choose an option: ")
|
||||||
# Check if the input is a number
|
# Check if the input is a number
|
||||||
@ -120,7 +121,7 @@ def normal_mode():
|
|||||||
product_price=c.execute("SELECT price FROM products WHERE id=?", (int(product_id),)).fetchone()[0]
|
product_price=c.execute("SELECT price FROM products WHERE id=?", (int(product_id),)).fetchone()[0]
|
||||||
# Ask the amount of the product
|
# Ask the amount of the product
|
||||||
product_amount=int(input("Bitte Anzahl des Produktes Eingeben: "))
|
product_amount=int(input("Bitte Anzahl des Produktes Eingeben: "))
|
||||||
sum_of_price=product_price*product_amount
|
sum_of_price=round(product_price*product_amount,2)
|
||||||
# Print the price of the sum
|
# Print the price of the sum
|
||||||
print("Summe:%s€" % sum_of_price)
|
print("Summe:%s€" % sum_of_price)
|
||||||
# Ask if the user wants to continue
|
# Ask if the user wants to continue
|
||||||
@ -136,7 +137,7 @@ def payment(sum_of_price):
|
|||||||
money_in_machine=input("Bitte Geld eingeben: ")
|
money_in_machine=input("Bitte Geld eingeben: ")
|
||||||
# Check if the money is a number
|
# Check if the money is a number
|
||||||
try:
|
try:
|
||||||
money_in_machine=int(money_in_machine)
|
money_in_machine=float(money_in_machine)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Bitte geben Sie eine Nummer ein")
|
print("Bitte geben Sie eine Nummer ein")
|
||||||
return
|
return
|
||||||
@ -151,45 +152,59 @@ def payment(sum_of_price):
|
|||||||
rest_cent=rest_euro*100
|
rest_cent=rest_euro*100
|
||||||
|
|
||||||
# 10 Euro
|
# 10 Euro
|
||||||
rest_euro_10=rest_cent//10000
|
rest_euro_10=rest_cent//1000
|
||||||
rest_cent=rest_cent-rest_euro_10*10000
|
rest_cent=rest_cent-rest_euro_10*10000
|
||||||
|
|
||||||
# 5 Euro
|
# 5 Euro
|
||||||
rest_euro_5=rest_cent//5000
|
rest_euro_5=rest_cent//500
|
||||||
rest_cent=rest_cent-rest_euro_5*5000
|
rest_cent=rest_cent-rest_euro_5*5000
|
||||||
|
|
||||||
# 2 Euro
|
# 2 Euro
|
||||||
rest_euro_2=rest_cent//2000
|
rest_euro_2=rest_cent//200
|
||||||
rest_cent=rest_cent-rest_euro_2*2000
|
rest_cent=rest_cent-rest_euro_2*2000
|
||||||
|
|
||||||
# 1 Euro
|
# 1 Euro
|
||||||
rest_euro_1=rest_cent//1000
|
rest_euro_1=rest_cent//100
|
||||||
rest_cent=rest_cent-rest_euro_1*1000
|
rest_cent=rest_cent-rest_euro_1*1000
|
||||||
|
|
||||||
# 50 Cent
|
# 50 Cent
|
||||||
rest_cent_50=rest_cent//500
|
rest_cent_50=rest_cent//50
|
||||||
rest_cent=rest_cent-rest_cent_50*500
|
rest_cent=rest_cent-rest_cent_50*500
|
||||||
|
|
||||||
# 20 Cent
|
# 20 Cent
|
||||||
rest_cent_20=rest_cent//200
|
rest_cent_20=rest_cent//20
|
||||||
rest_cent=rest_cent-rest_cent_20*200
|
rest_cent=rest_cent-rest_cent_20*200
|
||||||
|
|
||||||
# 10 Cent
|
# 10 Cent
|
||||||
rest_cent_10=rest_cent//100
|
rest_cent_10=rest_cent//10
|
||||||
rest_cent=rest_cent-rest_cent_10*100
|
rest_cent=rest_cent-rest_cent_10*100
|
||||||
|
|
||||||
# 5 Cent
|
# 5 Cent
|
||||||
rest_cent_5=rest_cent//50
|
rest_cent_5=rest_cent//5
|
||||||
rest_cent=rest_cent-rest_cent_5*50
|
rest_cent=rest_cent-rest_cent_5*50
|
||||||
|
|
||||||
print ("10 Euro: %s" % rest_euro_10)
|
# 1 Cent
|
||||||
print ("5 Euro: %s" % rest_euro_5)
|
rest_cent_1=rest_cent//1
|
||||||
print ("2 Euro: %s" % rest_euro_2)
|
rest_cent=rest_cent-rest_cent_1*1
|
||||||
print ("1 Euro: %s" % rest_euro_1)
|
|
||||||
print ("50 Cent: %s" % rest_cent_50)
|
if rest_euro_10 >=1:
|
||||||
print ("20 Cent: %s" % rest_cent_20)
|
print ("Sie bekommen %smal 10€" % rest_euro_10)
|
||||||
print ("10 Cent: %s" % rest_cent_10)
|
if rest_euro_5 >=1:
|
||||||
print ("5 Cent: %s" % rest_cent_5)
|
print ("Sie bekommen %smal 5€" % rest_euro_5)
|
||||||
|
if rest_euro_2 >=1:
|
||||||
|
print ("Sie bekommen %smal 2€" % rest_euro_2)
|
||||||
|
if rest_euro_1 >=1:
|
||||||
|
print ("Sie bekommen %smal 1€" % rest_euro_1)
|
||||||
|
if rest_cent_50 >=1:
|
||||||
|
print ("Sie bekommen %smal 50 Cent:" % rest_cent_50)
|
||||||
|
if rest_cent_20 >=1:
|
||||||
|
print ("Sie bekommen %smal 20 Cent:" % rest_cent_20)
|
||||||
|
if rest_cent_10 >=1:
|
||||||
|
print ("Sie bekommen %smal 10 Cent:" % rest_cent_10)
|
||||||
|
if rest_cent_5 >=1:
|
||||||
|
print ("Sie bekommen %smal 5 Cent:" % rest_cent_5)
|
||||||
|
if rest_cent_1 >=1:
|
||||||
|
print("Sie bekommen %smal 1 Cent" % rest_cent_1)
|
||||||
|
|
||||||
normal_mode()
|
normal_mode()
|
||||||
|
|
||||||
|
Binary file not shown.
20
3. Übungen/12.09.2022/Problem_48.py
Normal file
20
3. Übungen/12.09.2022/Problem_48.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Programm, welches das Problem "48" bearbeitet
|
||||||
|
# also überprüft, ob der Nachfolger einer zahl
|
||||||
|
# und der Nachfolger der Hälfte der Zahl jeweils Quadratzahlen sind
|
||||||
|
|
||||||
|
def ist_Quadratzahl(n):
|
||||||
|
if (n**(1/2)== int(n**(1/2))):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Hier ist normales Programm
|
||||||
|
|
||||||
|
i=1
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if ist_Quadratzahl(i+1) and ist_Quadratzahl(i/2+1):
|
||||||
|
print(i)
|
||||||
|
i+=1
|
34
3. Übungen/12.09.2022/Problem_48_home.py
Normal file
34
3. Übungen/12.09.2022/Problem_48_home.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Programm, welches das Problem "48" bearbeitet
|
||||||
|
# also überprüft, ob der Nachfolger einer zahl
|
||||||
|
# und der Nachfolger der Hälfte der Zahl jeweils Quadratzahlen sind
|
||||||
|
import logging
|
||||||
|
logging.basicConfig(filename='output.txt', level=logging.DEBUG, format='%(asctime)s: %(message)s')
|
||||||
|
|
||||||
|
def ist_Quadratzahl(n):
|
||||||
|
if (n**(1/2)== int(n**(1/2))):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
# Hier ist normales Programm
|
||||||
|
|
||||||
|
i=1
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if i%2==0:
|
||||||
|
if ist_Quadratzahl(i+1) and ist_Quadratzahl(i/2+1):
|
||||||
|
#print(i)
|
||||||
|
logging.debug(i)
|
||||||
|
i+=1
|
||||||
|
'''
|
||||||
|
|
||||||
|
i=2
|
||||||
|
|
||||||
|
while True:
|
||||||
|
iq = i**2
|
||||||
|
if (iq-1) % 2 == 0:
|
||||||
|
if ist_Quadratzahl((iq+1)/2):
|
||||||
|
logging.debug(iq-1)
|
||||||
|
i+=1
|
9
3. Übungen/16.06.2022/Insertionsort.py
Normal file
9
3. Übungen/16.06.2022/Insertionsort.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
data=[9,5,1,4,3]
|
||||||
|
for step in range (1, len(data)):
|
||||||
|
key=data[step]
|
||||||
|
j=step-1
|
||||||
|
while j>=0 and key < data[j]:
|
||||||
|
data[j+1]=data[j]
|
||||||
|
j=j-1
|
||||||
|
data[j+1]=key
|
||||||
|
print(data)
|
14
3. Übungen/16.06.2022/wiederholung_array.py
Normal file
14
3. Übungen/16.06.2022/wiederholung_array.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# Wiederholung Array/Feld
|
||||||
|
|
||||||
|
zahlen=[4,6,3,9,12,1,8] # Array wird erzeugt, hat bereits 7 Elemente
|
||||||
|
|
||||||
|
# Tausch zweier Werte aus dem Array (4 und 6)
|
||||||
|
zahlen[0],zahlen[1]=zahlen[1],zahlen[0]
|
||||||
|
print(zahlen)
|
||||||
|
|
||||||
|
''' # Summe des Arrays
|
||||||
|
summe=0
|
||||||
|
for i in range(7):
|
||||||
|
summe=summe+zahlen[i]
|
||||||
|
print(summe)
|
||||||
|
'''
|
31
3. Übungen/28.04.2022/insertionsort.py
Normal file
31
3. Übungen/28.04.2022/insertionsort.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Make a programm which asks the user for an input and then sorts the input of the user
|
||||||
|
|
||||||
|
# First ask the user how long he want the Array to be
|
||||||
|
array_length=int(input("Wie viele Zahlen sollen sortiert werden"))
|
||||||
|
# Second make an array
|
||||||
|
array=[]
|
||||||
|
# Third ask the user for number input
|
||||||
|
for i in range(array_length):
|
||||||
|
number=float(input("Bitte mir einfach eine Zahl geben"))
|
||||||
|
# Now append that number to the array
|
||||||
|
array.append(number)
|
||||||
|
# Now sort the numbers with the help of insertion sort
|
||||||
|
def insertionSort(array):
|
||||||
|
|
||||||
|
# Traverse through 1 to len(arr)
|
||||||
|
for i in range(1, len(array)):
|
||||||
|
|
||||||
|
key = array[i]
|
||||||
|
|
||||||
|
# Move elements of arr[0..i-1], that are
|
||||||
|
# greater than key, to one position ahead
|
||||||
|
# of their current position
|
||||||
|
j = i-1
|
||||||
|
while j >=0 and key < array[j] :
|
||||||
|
array[j+1] = array[j]
|
||||||
|
j -= 1
|
||||||
|
array[j+1] = key
|
||||||
|
insertionSort(array)
|
||||||
|
# print finished array
|
||||||
|
for i in range(len(array)):
|
||||||
|
print(array[i])
|
23
3. Übungen/28.04.2022/selectionsort.py
Normal file
23
3. Übungen/28.04.2022/selectionsort.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Make a programm which asks the user for an input and then sorts the input of the user
|
||||||
|
|
||||||
|
# First ask the user how long he want the Array to be
|
||||||
|
array_length=int(input("Wie viele Zahlen sollen sortiert werden"))
|
||||||
|
# Second make an array
|
||||||
|
array=[]
|
||||||
|
# Third ask the user for number input
|
||||||
|
for i in range(array_length):
|
||||||
|
number=float(input("Bitte mir einfach eine Zahl geben"))
|
||||||
|
# Now append that number to the array
|
||||||
|
array.append(number)
|
||||||
|
|
||||||
|
# Now sort them with the Help of the selection sort algorithm
|
||||||
|
for i in range(len(array)):
|
||||||
|
min_= i
|
||||||
|
for j in range(i+1, len(array)):
|
||||||
|
if array[min_] > array[j]:
|
||||||
|
min_ = j
|
||||||
|
#swap
|
||||||
|
array[i], array[min_] = array[min_], array[i]
|
||||||
|
# main
|
||||||
|
for i in range(len(array)):
|
||||||
|
print(array[i])
|
2
4. Theorie/Datentyp_str.md
Normal file
2
4. Theorie/Datentyp_str.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Neuer Datentyp:
|
||||||
|
str steht für String, also eine Zeichenkette asu einem oder mehreren Buchstaben
|
1
4. Theorie/Funktionen.md
Normal file
1
4. Theorie/Funktionen.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Funktionen in Python
|
1
4. Theorie/Insertionsort.drawio
Normal file
1
4. Theorie/Insertionsort.drawio
Normal file
@ -0,0 +1 @@
|
|||||||
|
<mxfile host="app.diagrams.net" modified="2022-05-05T12:35:58.899Z" agent="5.0 (Windows)" etag="9hpcv2ziGHfhq2m_BAw5" version="18.0.0" type="device"><diagram id="oKeNR1mCrY6Sv_lApMwD" name="Page-1">7VhNc9owEP01nmkPyVg2NnAMDm0O6bQdpmmTm7A3tlphUSGHj1/flSVjO4SEzjTgzPRipCftaiW99zA4fjRbfZR0nn0SCXDHc5OV4186ntcnAT41sLZA3zdAKlliIFIDE7YBC7oWLVgCi9ZEJQRXbN4GY5HnEKsWRqUUy/a0e8Hbq85pCjvAJKZ8F/3OEpUZdOD1a/wKWJpVK5NwaEZmtJpsd7LIaCKWDcgfO34khVCmNVtFwPXZVedi4j7sGd0WJiFXhwTc3PCrO5583oyKr9++FHwDw8mZ3cYD5YXdsOOFHPONEvaAzVQ3b0CmHFic4czNki3iDHJ9peUT5EKVjSkwg9zRjOuGyYMFNVI9kT2huY4yK+BVey6ud08zWSZbMsDnqJhOuW5MhFRVjql8nPXxWuWxq3V1l5Dg1dou5slEKnLKxzU6kqLIE9AH5mKvnnMtxBxBguBPUGpteUoLJRDK1IzbUVgx9UOHnwe2d2uT6fblqtlZV51cyXUjSHdvq3y6U4eVvSrO7E9vai8jLLQQhYzhGRpUyqIyBfXMvHDLW9Q7iBlgPRgngVPFHtp1UKu8dDuvJic2LD//gqtkh6sXUtK1E4wCHweiofaaaOgipyPfxdlRr0+c4HKHB+1bXmZMwWROywNaoom1b9QuClLB6vlz3j0XG9AjPRNiPTDoW0tY1o5CgtBgWcNNQveVjnJ4iOxzJ/Kdi16cocC1LMccZnrHum6Z4EdeaIXS0gtKmUpUsGJpKVSFZcDBJsCMoUgrcaaPW0PXDBfXLGd5Cve6oFGUqvP/FvDPLSA80AIGp7SAcK8FVPe/mJd8rK88/F2Ikio0/pWWl3sWCy6k41/ostPpOxLgKwnW43pBsG28N5yywRWfGkazpZtZseLbW/CfXu/U/kPIzqEcU5lNXW5V+oIySVOXDZm+vjIHByqTuE+z4DjSHHRCmnt1eYwSjPTNa8ieQjrtC753cl/wu/ONTQ7zhUff2O7xfKH6ifyyMXgnfW13T+wMRnNvwx864gye63bNGbxOsOik/DnuKk8ws2Mq0kLZU0jH9POab9zYrf9ELMca/8T64z8=</diagram></mxfile>
|
BIN
4. Theorie/Insertionsort.png
Normal file
BIN
4. Theorie/Insertionsort.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
1
4. Theorie/Quicksort.drawio
Normal file
1
4. Theorie/Quicksort.drawio
Normal file
@ -0,0 +1 @@
|
|||||||
|
<mxfile host="app.diagrams.net" modified="2022-05-12T12:23:06.951Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39" etag="UWRpgpNDgZNYL8Qyb3L_" version="17.2.1" type="device"><diagram id="FDAoAFaqsUSTd0yCK2Pk" name="Page-1">7Vvfk5sqFP5rfOyOgMbkceNu24feuZ3u3N7bvmTYSIx3VDJINsn+9YWAUaOmdn8Esu1T5AgI5/B953AgDgqz7QeGV8u/aERSB7rR1kE3DoRg7I7Fj5TslMT3oBLELIl0pUpwlzwSLXS1dJ1EpGhU5JSmPFk1hXOa52TOGzLMGN00qy1o2vzqCsekJbib47Qt/TeJ+FJJxz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0gek4UTImcaxm/EfaGegKeWZ/Pg5ML8F+jL0sz2eRorMjSedUQ3ukCiM+f0g6FE17MMzuT025t4dTqmnL4lJ2PH2x7zWLjIzL05rz++CDCgNhh+V6/v/8zre3AUXJrXbwd1muuAvgtgAdd5vm1cB18LFXZHDsZuTQ3NFkCjFxDKYR6DaabuGIgo2o6boMcneBbgqWfzMSvEIhea2W9AYKhPi+UhaGjVPSV4lIJBow6NTs4ajRm9qHRpR6TuRfALah8RVBcpSnxYgAbgNtFg/ooAMnvz/CloAObQMPRvGIbR0P9HDKt8g4/OhwZRrP4fpfYI1b/M0O0P</diagram></mxfile>
|
BIN
4. Theorie/Quicksort.drawio.png
Normal file
BIN
4. Theorie/Quicksort.drawio.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
12
4. Theorie/Quicksort.md
Normal file
12
4. Theorie/Quicksort.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Quicksort
|
||||||
|
- Pivoelement muss zuerst bestimmt werden, idealerweise der Median (Median: nicht ohne Sortierung bestimmbar)
|
||||||
|
- Prinzip: Teile und herrsche
|
||||||
|
## Beipiel:
|
||||||
|
253 401 24 590 281
|
||||||
|
253 24 281 401 590
|
||||||
|
\\\\
|
||||||
|
- Elemente werden mit Pivoelement verglichen und avor oder dahinter einsortiert
|
||||||
|
- Vorgang wird wiederholt, bis nur einelemntigre Teilmengen über sind (Rekursion)
|
||||||
|
## Übung:
|
||||||
|
58 12 3 7 62
|
||||||
|
3 7 12 58 62
|
1
4. Theorie/Selectionsort.drawio
Normal file
1
4. Theorie/Selectionsort.drawio
Normal file
@ -0,0 +1 @@
|
|||||||
|
<mxfile host="app.diagrams.net" modified="2022-05-05T12:25:59.185Z" agent="5.0 (Windows)" etag="zLYe7e7hk7v4KPXEtLL9" version="18.0.0" type="device"><diagram id="_qOt0WykFTrCSzvU5MhP" name="Page-1">7VlNc5swEP01zLSHdCwwNj7GOGkPTtsZT6fNUQYZ1AByhIjt/PquQOIj/i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//gDs/qRIJ+r/dJiXf0B</diagram></mxfile>
|
BIN
4. Theorie/Selectionssort.png
Normal file
BIN
4. Theorie/Selectionssort.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
4. Theorie/Thumbs.db
Normal file
BIN
4. Theorie/Thumbs.db
Normal file
Binary file not shown.
26
Tools/median-getter/main.py
Normal file
26
Tools/median-getter/main.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
from array import array
|
||||||
|
import numbers
|
||||||
|
import statistics
|
||||||
|
array=[]
|
||||||
|
|
||||||
|
def add_items_to_array():
|
||||||
|
print("Operations:\n1.Add numbers\n2.That are all numbers\n3.Exit\nThere are %s Elements in the array" %(len(array)))
|
||||||
|
operation=int(input("Operation:"))
|
||||||
|
if operation == 1:
|
||||||
|
numbers_to_add=float(input("Number:"))
|
||||||
|
array.append(numbers_to_add)
|
||||||
|
add_items_to_array()
|
||||||
|
elif operation == 2:
|
||||||
|
get_median()
|
||||||
|
elif operation == 3:
|
||||||
|
exit()
|
||||||
|
else:
|
||||||
|
print("Input the right operation")
|
||||||
|
add_items_to_array()
|
||||||
|
|
||||||
|
def get_median():
|
||||||
|
median_item=statistics.median(array)
|
||||||
|
print(median_item)
|
||||||
|
exit()
|
||||||
|
|
||||||
|
add_items_to_array()
|
23
output.txt
Normal file
23
output.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
2022-09-13 11:23:33,129: 48
|
||||||
|
2022-09-13 11:23:33,129: 1680
|
||||||
|
2022-09-13 11:23:33,129: 57120
|
||||||
|
2022-09-13 11:23:33,130: 1940448
|
||||||
|
2022-09-13 11:23:33,135: 65918160
|
||||||
|
2022-09-13 11:23:33,159: 2239277040
|
||||||
|
2022-09-13 11:23:33,306: 76069501248
|
||||||
|
2022-09-13 11:23:34,146: 2584123765440
|
||||||
|
2022-09-13 11:23:39,077: 87784138523760
|
||||||
|
2022-09-13 11:24:07,549: 2982076586042448
|
||||||
|
2022-09-13 11:32:51,334: 48
|
||||||
|
2022-09-13 11:32:51,334: 1680
|
||||||
|
2022-09-13 11:32:51,335: 57120
|
||||||
|
2022-09-13 11:32:51,336: 1940448
|
||||||
|
2022-09-13 11:32:51,341: 65918160
|
||||||
|
2022-09-13 11:32:51,366: 2239277040
|
||||||
|
2022-09-13 11:32:51,506: 76069501248
|
||||||
|
2022-09-13 11:32:52,320: 2584123765440
|
||||||
|
2022-09-13 11:32:57,098: 87784138523760
|
||||||
|
2022-09-13 11:33:24,936: 2982076586042448
|
||||||
|
2022-09-13 11:34:14,228: 17380816062160328
|
||||||
|
2022-09-13 11:35:05,575: 43707861882448008
|
||||||
|
2022-09-13 11:35:26,777: 58106601358565880
|
Reference in New Issue
Block a user