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="Age")
- w.pack()
- age = tkinter.simpledialog.askinteger("Age", "How old are you?")
- if age >= 3:
- tkinter.messagebox.showinfo("No diapers", "You don't need diapers");
- # 1. Compile the code and run it. The code asks for your age. Depending on
- # how old you are, it will tell you things that you are old enough to do.
- # Currently, it only does the first message. Your task is to make the code
- # print out the rest:
- #
- # If you are 3 or older than "you don't need diapers"
- # If you are 16 or older than "you can drive"
- # If you are 17 or older than "you can see an R rated movie"
- # If you are 18 or older than "you can vote"
- # If you are 21 or older than "you can gamble"
- # If you are 25 or older than "you can rent a car"
- # If you are 50 or older than "you can retire"
- #
- #
- # 2. If the age is less than 3, make the code tell you:
- # "Sorry, you are not old enough for anything yet"
- #
- # 3. If the age is equal to 0, make the code tell you:
- # "Welcome to the world!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement