lehrkraefte:blc:informatik:ffprg1-2020:funktionen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lehrkraefte:blc:informatik:ffprg1-2020:funktionen [2021/04/07 09:58]
Ivo Blöchliger [Sudoku parsen]
lehrkraefte:blc:informatik:ffprg1-2020:funktionen [2022/06/23 12:58] (current)
Ivo Blöchliger [Sudoku parsen]
Line 5: Line 5:
  
 ===== Theorie ===== ===== Theorie =====
-Unterpogramme geben keine Werte zurück, z.B.+Unterprogramme geben keine Werte zurück, z.B.
 <code python> <code python>
 def hello(wer):  # Definition des Unterprogramms, führt noch nichts aus! def hello(wer):  # Definition des Unterprogramms, führt noch nichts aus!
Line 35: Line 35:
     return a     return a
          
-def kompliziert(a,b)+def kompliziert(a,b):
    a = summe(a,b)    a = summe(a,b)
    b = produkt(a,b)    b = produkt(a,b)
Line 77: Line 77:
     if (j==i):  # Zufällig die gleiche Position erwischt? Also j um eins erhöhen.     if (j==i):  # Zufällig die gleiche Position erwischt? Also j um eins erhöhen.
         j+=1         j+=1
-    return buchstabenVertauschen(wort, i, j)+    return buchstabenTauschen(wort, i, j)
  
 def wortWuerfeln(wort): def wortWuerfeln(wort):
-    wort = buchstabenTauschen(wort)+    wort = buchstabenWuerfeln(wort)
     if (len(wort)>8):     if (len(wort)>8):
-        wort = buchstabenTauschen(wort)+        wort = buchstabenWuerfeln(wort)
     return wort     return wort
  
Line 189: Line 189:
 sudoku1 = "003020600900305001001806400008102900700000008006708200002609500800203009005010300" sudoku1 = "003020600900305001001806400008102900700000008006708200002609500800203009005010300"
 sudoku2 = "200080300\n060070084\n030500209\n000105408\n\n000000000\n402706000\n301007040\n720040060\n004010003" sudoku2 = "200080300\n060070084\n030500209\n000105408\n\n000000000\n402706000\n301007040\n720040060\n004010003"
-sodoku3 = "......9.7\r\n...42.18.\r\n...7.5.26\r\n1..9.4...\r\n.5.....4.\r\n...5.7..9\r\n92.1.8...\r\n.34.59...\r\n5.7......"+sudoku3 = "......9.7\r\n...42.18.\r\n...7.5.26\r\n1..9.4...\r\n.5.....4.\r\n...5.7..9\r\n92.1.8...\r\n.34.59...\r\n5.7......"
 </code> </code>
 Ausgaben: Ausgaben:
Line 357: Line 357:
  
 def permutationen(n): def permutationen(n):
-    a = lsit(range(n))+    a = list(range(n))
     return [num2perm(j,a) for j in range(factorial(n))]     return [num2perm(j,a) for j in range(factorial(n))]
  
  • lehrkraefte/blc/informatik/ffprg1-2020/funktionen.1617782304.txt.gz
  • Last modified: 2021/04/07 09:58
  • by Ivo Blöchliger