This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 + 1 | |
100 – 1 | |
100 / 7 | |
100 / 7.0 | |
100 % 7 | |
100 * 4 | |
100 ** 2 | |
100 ** 0.5 | |
(100+1) * 2 | |
100 + 1 * 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Links und Unterlagen zum Seminar "Unterrichten mit Python" | |
# python | |
http://python.org - download | |
offizielle Dokumentation der Module (z.B. turtle modul) -> Documentaion -> Library Reference -> Modul aussuchen, | |
z.B. turtle Modul: | |
https://docs.python.org/3/library/turtle.html | |
## Tutorials für Python: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import turtle as t | |
p1 = t.Turtle() | |
p1.left(70) | |
p1.speed=9 | |
p1.dx = math.cos(p1.heading()*math.pi/180)*p1.speed | |
p1.dy = math.sin(p1.heading()*math.pi/180)*p1.speed | |
for step in range(100): | |
x = p1.xcor() | |
y = p1.ycor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# legend: #=rock .=floor f=food T=treasure | |
dungeon = """ | |
############################################### | |
#.....fff.#..............#f#.T#.....#.......#T# | |
#.........#..............###....###.#.....#.#.# | |
#.........f.....T...f.........##T......f..#...# | |
############################################### | |
""" # add more line to the dungeon! | |
player, msg = "@", "welcome @, move with w,a,s,d" | |
px, py, dx, dy = 1, 1, 0, 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# legend: #=rock .=floor f=food T=treasure | |
dungeon = """ | |
############################################### | |
#.....fff.#..............#f#.T#.....#.......#T# | |
#..S......#..............###....###.#.....#.#.# | |
#..SS.....f.....T...f.........##T......f..#...# | |
############################################### | |
""" # add more line to the dungeon! | |
player, msg = "@", "welcome @, move with w,a,s,d" | |
px, py, dx, dy, php = 1, 1, 0, 0, 10 # position, movement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
# legend: #=rock .=floor f=food T=treasure | |
dungeon = """ | |
############################################### | |
#.....fff.#..............#f#.T#.....#.......#T# | |
#..S......#..............###....###.#.....#.#.# | |
#..SS.....f.....T...f.........##T......f..#...# | |
############################################### | |
""" # add more line to the dungeon! | |
player, msg = "@", "welcome @, move with w,a,s,d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# legend: #=rock .=floor f=food $=gold | |
DUNGEON = ''' | |
############################################### | |
#.....fff.#..............#f#.$#.....#.......#$# | |
#.........#..............###....###.#.....#.#.# | |
#.........f.....$...f.........##$......f..#...# | |
############################################### | |
''' # add more lines to the dungeon! | |
PLAYER = '@' | |
PROMPT = 'Type your command or ? and press Enter:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# legend: #=rock .=floor f=food $=gold | |
DUNGEON = ''' | |
############################################### | |
#.....fff.#..............#f#.$#.....#.......#$# | |
#.........#..............###....###.#.....#.#.# | |
#.........f.....$...f.........##$......f..#...# | |
############################################### | |
''' # add more lines to the dungeon! | |
PLAYER = '@' | |
PROMPT = 'Type your command or ? and press Enter:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# legend: #=rock .=floor f=food $=gold | |
DUNGEON = ''' | |
############################################### | |
#.....fff.#..............#f#.$#.....#.......#$# | |
#....S....#..............###....###.#.....#.#.# | |
#....S.S..f.....$...f.........##$......f..#...# | |
############################################### | |
''' # add more lines to the dungeon! | |
PLAYER = '@' | |
PROMPT = 'Type your command or ? and press Enter:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
def baum(laenge=50, winkel=30, minimum=5): | |
if laenge < minimum: | |
return | |
turtle.fd(laenge) | |
turtle.left(winkel) | |
turtle.fd(laenge/2) | |
baum(laenge/2, winkel, minimum) |