Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1.  
  2. # Created by: James Sanii
  3. # Created on: Sep 2016
  4. # Created for: ICS3U
  5. # This program shows the difference between local and global variables
  6.  
  7. import ui
  8.  
  9. variableX = 25
  10.  
  11. def local_button_touch_up_inside(sender):
  12. # shows what happen with local variable
  13.  
  14. variableX = 10
  15. variableY = 30
  16. variableZ = variableX + variableY
  17.  
  18. view['local_answer_label'].text = str(variableZ)
  19.  
  20. def global_button_touch_up_inside(sender):
  21. # shows what happen with global variable
  22.  
  23. #global variableX
  24. #variableX = variableX + 1
  25. variableY = 30
  26. variableZ = variableX + variableY
  27.  
  28. view['global_answer_label'].text = str(variableZ)
  29.  
  30. view = ui.load_view()
  31. view.present('full_screen')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement