Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| lehrkraefte:blc:informatik:ffprg1-2019:challenges [2019/01/20 09:17] – Ivo Blöchliger | lehrkraefte:blc:informatik:ffprg1-2019:challenges [2019/02/05 16:48] (current) – mirco_buechel | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Challenges ====== | ||
| + | Es gibt zwei Dateien: | ||
| + | * {{ : | ||
| + | * {{ : | ||
| + | |||
| + | ===== Vorgehen ===== | ||
| + | * Legen Sie einen Ordner ' | ||
| + | * Starten Sie TigerJython (evtl. auf die [[http:// | ||
| + | * Öffnen Sie mit TigerJython die beiden Dateien challenge.py und checker.py | ||
| + | * Führen Sie checker.py aus. Dabei muss für jede Challenge das Resultat erscheinen (1. Challenge OK, alle 6 anderen FAIL) | ||
| + | * Studieren Sie die Datei challenge.py. | ||
| + | * Beginnen Sie mit der Lösung der Challenge Ihrer Wahl. Stellen Sie Fragen bei technischen Problemen. | ||
| + | |||
| + | ===== Lösungsvorschläge ===== | ||
| + | ==== hello ==== | ||
| + | <code python> | ||
| + | # Autor: Ivo Bloechliger | ||
| + | def hello(): | ||
| + | print(" | ||
| + | </ | ||
| + | ==== hifive ==== | ||
| + | <code python> | ||
| + | # mirco | ||
| + | def hifive(n): | ||
| + | for i in range(n): | ||
| + | print(' | ||
| + | print(' | ||
| + | </ | ||
| + | |||
| + | ==== rampe ==== | ||
| + | <code python> | ||
| + | # mirco | ||
| + | def rampe(n): | ||
| + | for i in range(n): | ||
| + | print((i+1)*'#' | ||
| + | </ | ||
| + | ==== tree ==== | ||
| + | <code python> | ||
| + | # mirco | ||
| + | def tree(n): | ||
| + | for i in range(n): | ||
| + | print((n-1-i)*' | ||
| + | print((n-1)*' | ||
| + | </ | ||
| + | ==== teiler ==== | ||
| + | <code python> | ||
| + | # mirco | ||
| + | def teiler(n): | ||
| + | for i in range(n): | ||
| + | if i!=0: | ||
| + | if n%i==0 : | ||
| + | print(i) | ||
| + | print(n) | ||
| + | </ | ||
| + | ==== prim ==== | ||
| + | <code python> | ||
| + | # mirco | ||
| + | def prim(n): | ||
| + | x=0 | ||
| + | for i in range(n): | ||
| + | if i!=0 and i!=1: | ||
| + | if n%i==0: | ||
| + | x=1 | ||
| + | if n==0 or n==1: | ||
| + | x=1 | ||
| + | if x==1: | ||
| + | print(str(n)+' | ||
| + | if x!=1: | ||
| + | print(str(n)+' | ||
| + | </ | ||
| + | ==== grid ==== | ||
| + | <code python> | ||
| + | # mirco | ||
| + | def grid(x,y): | ||
| + | for i in range(y): | ||
| + | print(x*' | ||
| + | print(x*' | ||
| + | print(x*' | ||
| + | </ | ||