Answered step by step
Verified Expert Solution
Link Copied!

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.
(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What Is a Work/Life Balance? LOP85

Answered: 1 week ago