revision
play

Revision Python - Nick Reynolds April 7, 2017 Revision (~15 mins) - PowerPoint PPT Presentation

Revision Python - Nick Reynolds April 7, 2017 Revision (~15 mins) This Class Quiz (45 mins) Practical Revision Conditionals and or Whats the difference? Revision If it is raining and I am going outside, take an


  1. Revision Python - Nick Reynolds April 7, 2017

  2. Revision (~15 mins) ● This Class ● Quiz (45 mins) Practical ●

  3. Revision

  4. Conditionals

  5. and or What’s the difference? Revision

  6. If it is raining and I am going outside, take an umbrella. If it is raining or I am going outside, take an umbrella. Revision

  7. If raining and goingOutside: takeUmbrella() If raining or goingOutside: takeUmbrella() Revision

  8. If raining and goingOutside: takeUmbrella() elif not raining and goingOutside(): takeHat() else : makeCoffee() Revision

  9. Loops

  10. foods = ["Apple", 'Orange'] for _____ in foods : ... What goes here? Revision

  11. foods = ["Apple", 'Orange'] for anything_you_want in foods : ... Any variable name you want Revision

  12. foods = ["Apple", 'Orange'] count = 0 while count < len(foods) : print(foods[count]) Have I forgotten anything? Revision

  13. foods = ["Apple", 'Orange'] count = 0 while count < len(foods) : print(foods[count]) count += 1 Need to increment count! Revision

  14. Functions

  15. def highest(num1, num2): ... What are these? Revision

  16. def highest_print(num1, num2): if num1 > num2: print (num1) else : print (num2) def highest_return(num1, num2): if num1 > num2: return num1 else : What’s the difference? return num2 Revision

  17. This evaluates to nothing! >>> highest_print(1, highest_print(3, 4)) # Error! >>> highest_return(1, highest_return(3, 4)) # 4 Return decides the result of the function Print just prints out to the console Revision

  18. Pen and Paper Quiz (45 mins)

  19. Practical & Assignment 1

  20. References ● http://pwp.stevecassidy.net/python/more- python.html ● https://thenounproject.com/

Recommend


More recommend