python
play

Python Session # 4 By: Saeed Haratian Spring 2016 Outlines - PowerPoint PPT Presentation

Fundamentals of Programming Python Session # 4 By: Saeed Haratian Spring 2016 Outlines turtle Module The for Loop turtle methods and tricks Functions turtle Module


  1. ميـــحرلا نحنحنرلا للوللوا مــسب Fundamentals of Programming Python Session # 4 By: Saeed Haratian Spring 2016

  2. Outlines  turtle Module  The for Loop  turtle methods and tricks  Functions

  3. turtle Module  Screen  mainloop  bgcolor  title  Turtle  forward  left  color  pensize

  4. The for Loop for i in [0,1,2,3]: alex.forward(50) alex.left(90) for i in range(4): alex.forward(50) alex.left(90)

  5. The for Loop … for c in ["yellow", "red", "purple", "blue"]: alex.color(c) alex.forward(50) alex.left(90) clrs = ["yellow", "red", "purple", "blue"] for c in clrs: alex.color(c) alex.forward(50) alex.left(90)

  6. more turtle methods and tricks  Turtle  backward  right  penup  pendown  speed  shape  stamp

  7. Functions  Syntax : def NAME( PARAMETERS ): STATEMENTS  Some Functions Require Parameter like abs, pow, max  Fruitful Function  Void Function

  8. Example : Compound Interest

  9. Function Variables  create a local variable inside a function  only exists inside the function  cannot use it outside

Recommend


More recommend