Count the Visitors
Python
15 pts
Count the Visitors
The museum in Massawa counts its visitors. The function add_visitor() should add 1 to the global variable visitors, but it is not finished.
Complete the function using the global keyword. The program calls it three times and then prints the total.
Expected output:
3
Checklist
- Complete
add_visitor()so that each call adds 1 to the globalvisitors. - Run the program so it prints the total after three calls.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
