subject

Part B There are many different ways that a user could tell us that he or she would like to add two numbers in our calculator program. The user could type “add”, “Add”, “ADD”, or “+”, to name a few possibilities. Of course, as humans, we know exactly what is meant, even if the word is capitalized. But the Python Interpreter can’t tell that “add” is the same as “Add”.

We can use a list to make our program a bit more robust. We can also use the IN operator to check for certain values in that list. Take a look at this if statement’s opening line:

if operation in [“add”, “Add”, “ADD”, “+”]:
Make those changes in your program and verify that it works.
Consider all of the possible words the user might enter to subtract, multiply, or divide.
Rewrite the first lines of each of your if statements to use lists.
Thoroughly test your new program, trying out each of the four operations.
Share the link to your Python code in REPL. it with your teacher by clicking on the share button and copying the link.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 03:10
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e.g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
In the blank libreoffice writer document, to start the process of entering a date field into a letter, click on the insert menu. edit menu. file menu. fields menu.
Answers: 3
question
Computers and Technology, 24.06.2019 17:00
The length of time that a slide appears before automatically advancing to the next slide can be set in the timing group under the transitions tab. transition to this slide group under the transitions tab. timing group in the master slide view. transition to this slide group in the master slide view.
Answers: 1
question
Computers and Technology, 25.06.2019 02:00
Feedback is one of the basic elements games have in common true false
Answers: 2
You know the right answer?
Part B There are many different ways that a user could tell us that he or she would like to add two...
Questions
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Physics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
question
Mathematics, 16.09.2020 14:01
Questions on the website: 13722362