Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import tkinter.simpledialog
- import tkinter.messagebox
- root = Tk()
- w = Label(root, text="Count")
- w.pack()
- x = 1
- while x <= 5:
- tkinter.messagebox.showinfo("x", "x equals " + str(x))
- x += 1
- # Run the program and answer the following:
- # 1. How many messages are output?
- # 2. What do you think the x += 1 does?
- # 3. What would you have to change to make the program output only 3 messages?
- # 4. This part is to be checked off when you get it running. Change the code to
- # count to 10 by 2s. It should stop after it gets to 10. Write down your changes.
- # Example:
- # 2
- # 4
- # 6
- # 8
- # 10
- # 5. In your own words, summarize what the while does.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement