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.
It expects a command 'add' and two positive integers eg in the command line arguments and outputs the addition result of the given integers eg Then it constantly asks for new command input from the user for addition using a while loop. The program always assumes there are three components separated by a space in the user input, and 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
