Question: Write a program that repeatedly asks for commands of adding two integers. When the user enters DONE, the program will be stopped. ( 1 )

Write a program that repeatedly asks for commands of adding two integers. When the user enters DONE, the program will be stopped.
(1) It expects a command 'add' and two positive integers (e.g.3,4) in the command line arguments and outputs the addition result of the given integers (e.g.7).(2) Then it constantly asks for new command input from the user for addition using a while loop. (3) The program always assumes there are three components separated by a space in the user input, and 4) checks for the validity of each component using if statements. For example, if the first component is not 'add' or any of the two remaining components is not a positive integer, the program should remind the user to give a valid input. The following sample output would show what should be validated.You MUST use int(), print(), isdigit(), split(), while and if statement, and the sys module.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!