LearnPy Hub
← Classes & Objects problems
Easy

Light Switch

Write class Light starting off, with toggle() and status() (returns on or off). Read n and toggle n times, printing the status after each toggle on one line.

Input

One integer.

Output

One line.

Sample 1

Input
3
Output
on off on

Sample 2

Input
1
Output
on
solution.py
Output appears here
Light Switch · Python practice problem · LearnPy Hub