To build a command line application, you need to learn the following modules:
sys- Module of the week -- specifically the Runtime environment
argparsefileinput
-
The program
alarm.pypops up a user-specified message after 2 minutes. The message can be any piece of text, and is displayed calling the (ficticious) functionalert(). When the user typesalarm.py Switch off your laptop, write a program that callsalert('Switch off your laptop', seconds=120). -
We want to allow the user to specify how many seconds later the alarm should be set. So, for example, if we type:
alarm.py --seconds=30 Hello... change the program to call
alert('Hello', seconds=30). If--secondsis not specified, it sets--secondsto 120 seconds. -
The user may want the alarm to be specified at multiple times. So, if we type:
alarm.py --seconds=10 --seconds=20 Hello... change the program to call
alert('Hello', seconds=10)followed byalert('Hello', seconds=20).