Question: using pythoncode create Arithmetic You are writing programs that use arithmetic, those confined to using the integers that are greater than or equal to zero.

using pythoncode create

Arithmetic You are writing programs that use arithmetic, those confined to using the integers that are greater than or equal to zero. Lets say that the + operation in your programming language somehow has become disabled. But there is a basic machine operation called succ() short for successor that can calculate the successor to its integer argument. Heres the definition of the succ() function: def succ(n): return n+1 Now you need to build a fruitful function that simulates the add() function. You can do this using this definition: def add(m, n): if m == 0: return n if n == 0: return m return add(m 1, succ(n)) You can see that this (recursive) function just calls itself counting down the first argument and incrementing the second argument until the first argument is zero. There are other ways to accomplish the same thing. Somehow the * operation in your programming just broke as well! For this exercise, your job is to create a fruitful function called mpy(m,n) for multiply that calculates the product of m x n but without using the * operator. You will need to do something like what was done for the add function. Remember that multiplication is just repeated addition. So, m x n is just a way of saying add n to a sum (that starts at zero) m times. The succ() function has been provided for you in a script file called Built_In.py. Your program should import succ from this file. This will demonstrate how you can build a Python program that uses separate files for different parts of the work to be done. Your main driver should contain a definition for the add() function and then it should print a multiplication table like what is shown in the Sample Output below.

The multiplication though 3X3

0 1 2 3

0 0 0 0 0

1 0 1 2 3

2 0 2 4 6

3 0 3 6 9

The multiplication table though 7 x 7

0 1 2 3 4 5 6 7

0 0 0 0 0 0 0 0

1 0 1 2 3 4 5 6 7

2 0 2 4 6 8 12 14

3 0 3 6 9 12 18 21

4 0 4 8 12 16 24 28

5 0 5 10 15 20 30 35

6 0 6 12 18 24 36 42

7 0 7 14 21 28 42 49

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!