Phone vs Website | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Phone vs Website

Hi! I have solo learn on my phone and also work in the website. I'm developing an easy code in python, but the output is not the same...¿is this possible? This is the code: x = ("24 + 4","445 - 555","3 + 5","50 - 446") first, second, separator, maxlen = [],[],[],[] def arithmetic_arrenger(problems): for i in problems: parts = i.split() if len(parts[0]) > len(parts[2]): first.append(parts[0]) second.append(parts[1] + " " + parts[2].rjust(len(parts[0]),"0")) separator.append("-" * (len(parts[0])+2)) maxlen.append(len(parts[0])) else: first.append(parts[0].rjust(len(parts[2]),"0")) second.append(parts[1] + " " + parts[2]) separator.append("-" * (len(parts[2])+2)) maxlen.append(len(parts[2])) for i in first: if len(i) > 4: print("Error: Numbers cannot be more than four digits.") elif i.isalpha(): print("Error: Numbers must only contain digits.") else: continue for i in second: if len(i[2:]) > 4: print("Error: Numbers cannot be more than four digits.") elif i[2:].isalpha(): print("Error: Numbers must only contain digits.") else: continue for i in second: if i[0] == "+": continue elif i[0] == "-": continue else: print("Error: Operator must be '+' or '-'.") if len(problems) < 5: for i in first: print(i.rjust((len(i)+2)," "),end=" ") print("\n") for i in second: print(i,end=" ") print("\n") for i in range(len(problems)): print(separator[i],end=" ") else: print("Error: Too many problems.") arithmetic_arrenger(x) On my phone I can see it with the spacing as I want, but the output on the website is different. Is like the 4 spaces on last if statement just work on the phone, but on the website only takes 1. So, the question is, ¿which output is the correct one?

18th Dec 2020, 7:53 PM
Goyo Dominguez
Goyo Dominguez - avatar
0 Answers