Download presentation
Presentation is loading. Please wait.
Published byAndrew Ward Modified over 9 years ago
1
Xin Liu
2
* Use python 3.0 or later version * Major differences from earlier versions * Interactive mode * For quick experiments * “python3” to enter * print(’python programming is fun!’) * “Ctl+D” to quit * Script mode * For regular programs, that can be executed repeatedly * Edit a program (with gedit) * python3 myprogram.py
3
* In gedit, create the first.py containing the following program * In terminal, run the program by typing print(‘hello world!’) print(‘this is my first python program’) Print(‘it’s funny’) Python3 first.py
4
* http://docs.python.org/3/library/turtle.html http://docs.python.org/3/library/turtle.html (0, 0) (100, 100) Cartesian plane
5
* import turtle * clear() * title(‘window name’) * goto(x, y) * forward(distance) * back(distance) * left(angle) * right(angle) * circle(radius) * begin_fill() * end_fill() * pencolor(r, g, b), 0 <= r, g, b <= 1 * fillcolor(r, g, b) * write(‘a string’)
6
* Just to get a feeling of programming from turtle import * color('red', 'yellow') begin_fill() while True: forward(200) left(170) if abs(pos()) < 1: break end_fill() done()
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.