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
lehrkraefte:blc:informatik:ffprg1-2019:challenges [2019/02/05 17:46]
mirco_buechel
lehrkraefte:blc:informatik:ffprg1-2019:challenges [2019/02/05 17:48] (current)
mirco_buechel
Line 30: Line 30:
 ==== rampe ==== ==== rampe ====
 <code python> <code python>
 +# mirco
 def rampe(n): def rampe(n):
     for i in range(n):     for i in range(n):
Line 35: Line 36:
 </code> </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.1549385205.txt.gz
  • Last modified: 2019/02/05 17:46
  • by mirco_buechel