Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started