Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1messagebox.showinfo("Result", "Total saved") | Ashowinfo() shows an information icon, which is wrong for invalid input. Fix: use messagebox.showerror("Error", "Invalid age entered") so the user sees an error pop-up. | |
| 2messagebox.showerror("Invalid", "Enter a number") | Bif not age.isdigit(): messagebox.showerror("Error", "Age must be a number") | |
| 3Import messagebox from tkinter so pop-up message functions can be used in a program. | CPops up an information window titled Result that tells the user the total was saved. | |
| 4A button handler checks the entry text and shows an error pop-up when the input is not a number. | Dfrom tkinter import messagebox | |
| 5messagebox.showinfo("Your score is 90") | Eshowinfo() needs both a title and a message. Only one string is given, so Python raises a TypeError. Fix: messagebox.showinfo("Score", "Your score is 90"). | |
| 6messagebox.showinfo("Error", "Invalid age entered") | FPops up an error window titled Invalid that tells the user their input was wrong. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
messagebox.showinfo() — Pops up a message window to tell the user a result. Its partner messagebox.showerror() pops up an error, such as when a handler finds invalid input. Both need a title and a message.messagebox.showinfo("Result", "Saved!")messagebox.showerror
("Error", "Enter a number")from tkinter import messageboxmsg = "Saved"
messagebox.showinfo("Info", msg)if not age.get().isdigit():
messagebox.showerror("Error", "Digits")