Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using python code the Big Integer Addition/Subtraction please complete problem c

ID: 3790260 • Letter: U

Question

Using python code the Big Integer Addition/Subtraction please complete problem completely supply functional working output of the code and also follow the read input guidelines a partial piece of the code have been provided please have full explanation thank you. Provide the code to fill in area

Big Integer Addition/Subtraction You are given two integers a and b and an operator or and your job is to compute a+/-b. The input for the first part consists of three lines. In the first line, comes the digits of integer a, separated by space and most significant digit first. In the second line, comes b in the same format. Finally in the third line, comes a character, which is or The output of your program should consist of only one line, listing all the digits of the answer following the same format as input integers. The input is prepared in such a way that the result of subtraction is never negative. Part 1: Input Sample: 948 84 (948 and 84 are the two values you need to add/subtract.The third argument lets you know the operation.) Output: 1 0 3 2 (Represents 1,032)

Explanation / Answer

please find the python code

  

import sys
import re

# press ctrl+d to stop entering any further line

userInput = sys.stdin.readlines()

print userInput
i=0

# since there will be only three rows so below line of code is static, and not using any loop

int1 = userInput[0]
int2 = userInput[1]
op = userInput[2]

int1 = re.sub('[s+]', '', int1)
int2 = re.sub('[s+]', '', int2)

print op
print int1
print int2

int3 = ''

if op.find("-") == -1:
int3 = (int(int1)+int(int2))
else :
int3 = (int(int1)-int(int2))


line2 =''
for ch in str(int3):
line2 = line2+ ch+ " "

print line2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote