Advertisement
MrsMcLead

ECS count

Nov 21st, 2013
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. from tkinter import *
  2. import tkinter.simpledialog
  3. import tkinter.messagebox
  4.  
  5. root = Tk()
  6. w = Label(root, text="Count")
  7. w.pack()
  8.  
  9. x = 1
  10. while x <= 5:
  11.     tkinter.messagebox.showinfo("x", "x equals " + str(x))
  12.     x += 1
  13.  
  14.  
  15. # Run the program and answer the following:
  16. # 1. How many messages are output?
  17. # 2. What do you think the x += 1 does?
  18. # 3. What would you have to change to make the program output only 3 messages?
  19. # 4. This part is to be checked off when you get it running.  Change the code to
  20. #    count to 10 by 2s.  It should stop after it gets to 10.  Write down your changes.  
  21. #   Example:
  22. #       2
  23. #       4
  24. #       6
  25. #       8
  26. #          10
  27. # 5. In your own words, summarize what the while does.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement