Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with my python code. my output is saying None seconds for the prime and successive. from stopwatch import stopwatch def backward (
I need help with my python code. my output is saying None seconds for the prime and successive. from stopwatch import stopwatch
def backwardAB:
if A B:
T A
else:
T B
while True:
if B T :
T T
elif A T :
T T
else:
return T
def primeA B:
def numbersN:
p
nums
while N pp:
if N p:
nums.appendp
N N p
else:
p p
nums.appendintN
return nums
Anum numbersA
Bnum numbersB
gcd
if lenAnum lenBnum:
for Adom in Anums:
gcd gcd Adom
Bnum.removeAdom
else:
for Bdom in Bnumbers:
gcd gcd Bdom
Anum.removeBdom
return gcd
def successiveAB:
if A :
return B
if B :
return A
while A and B :
if A B:
A A B
else: B B A
def main:
AintinputPlease enter the first integer:
BintinputPlease enter the second integer:
seconds stopwatch
printThe Backwards For Loop: seconds".formatbackwardABseconds.lap
printThe Prime Factorization: seconds".formatprimeABseconds.lap
printThe Successive: seconds".formatsuccessiveABseconds.lap
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started