lehrkraefte:blc:informatik:ffprg1-2019:challenges

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-2019:challenges [2019/02/05 12:54]
Ivo Blöchliger [hello]
lehrkraefte:blc:informatik:ffprg1-2019:challenges [2019/02/05 17:48] (current)
mirco_buechel
Line 15: Line 15:
 ==== hello ==== ==== hello ====
 <code python> <code python>
-# Autor: Ivo Blöchliger+# Autor: Ivo Bloechliger
 def hello(): def hello():
     print("Hello world")     print("Hello world")
 </code> </code>
 ==== hifive ==== ==== hifive ====
 +<code python>
 +# mirco
 +def hifive(n):
 +    for i in range(n):
 +        print('Hi!')
 +    print('Five')
 +</code>
 +
 ==== rampe ==== ==== rampe ====
 +<code python>
 +# mirco
 +def rampe(n):
 +    for i in range(n):
 +        print((i+1)*'#')
 +</code>
 ==== tree ==== ==== tree ====
 +<code python>
 +# mirco
 +def tree(n):
 +    for i in range(n):
 +        print((n-1-i)*' '+(1+2*i)*'^')
 +    print((n-1)*' '+'|')
 +</code>
 ==== teiler ==== ==== teiler ====
 +<code python>
 +# mirco
 +def teiler(n):
 +    for i in range(n):
 +        if i!=0:
 +            if n%i==0 :
 +                print(i)
 +    print(n)
 +</code>
 ==== prim ==== ==== 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)+' nicht prim')
 +    if x!=1:
 +        print(str(n)+' prim'
 +</code>
 ==== grid ==== ==== grid ====
 +<code python>
 +# mirco
 +def grid(x,y):
 +    for i in range(y):
 +        print(x*'+---'+'+')
 +        print(x*'  '+'|')
 +    print(x*'+---'+'+')
 +</code>
  
  • lehrkraefte/blc/informatik/ffprg1-2019/challenges.1549367643.txt.gz
  • Last modified: 2019/02/05 12:54
  • by Ivo Blöchliger