Advertisement
MrsMcLead

ECS Age

Nov 19th, 2013
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.13 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="Age")
  7. w.pack()
  8.  
  9. age = tkinter.simpledialog.askinteger("Age", "How old are you?")
  10.  
  11. if age >= 3:
  12.     tkinter.messagebox.showinfo("No diapers", "You don't need diapers");
  13.        
  14.        
  15.  
  16. #   1.  Compile the code and run it.  The code asks for your age.  Depending on
  17. #   how old you are, it will tell you things that you are old enough to do.  
  18. #   Currently, it only does the first message.  Your task is to make the code
  19. #   print out the rest:
  20. #
  21. #   If you are  3 or older than  "you don't need diapers"
  22. #   If you are 16 or older than  "you can drive"
  23. #   If you are 17 or older than  "you can see an R rated movie"
  24. #   If you are 18 or older than  "you can vote"
  25. #   If you are 21 or older than  "you can gamble"  
  26. #   If you are 25 or older than  "you can rent a car"
  27. #   If you are 50 or older than  "you can retire"  
  28. #
  29. #
  30. #   2.  If the age is less than 3, make the code tell you:  
  31. #       "Sorry, you are not old enough for anything yet"
  32. #
  33. #   3.  If the age is equal to 0, make the code tell you:
  34. #               "Welcome to the world!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement