• Home
  • Blog
  • ENTD 220 APUS WK 6 Use List to Create a Menu & Add Two Numbers Program

ENTD 220 APUS WK 6 Use List to Create a Menu & Add Two Numbers Program

0 comments

I’m working on a python exercise and need an explanation and answer to help me learn.

1) Use list to create a menu. The menu will look like this

1) Add two numbers

2) Mult two number

3) Divide

4) Scalc

The menu doesn’t have to do anything, but if you want to try to take input and call your math functions from mylib.py, go for it. 

2) Create a dictionary called allInOne

3) Prompt user for the two numbers (this code should already exist, along with all the error-checking)

4) Create a function the will save the results of the operation in the dictionary allInOne(n1, n2).

For example, if the user enters 5 and 2, the result of the dictionary would be: {“add”: 7, “sub” : 3, “mult”: 10, “div”: 2.5}

You will print the results and they would look like:

5 + 2 = 7
5 – 2 = 3
5 * 2 = 10
5 / 2 = 2.5

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}