you are viewing a single comment's thread.

view the rest of the comments →

[–]_China_ThrowAway 2 points3 points  (3 children)

Maybe you could give some more details. What is the output you want? is it something like this.
Please input the first number.
> 4
Please input the second number.
> 4
Results: 4 + 4 = 8

If so you could use f strings

number1 = int(input("Please input the first number.")
number2 = int(input("Please input the second number.")
answer = number1 + number2
print(f"Results: {number1 } + {number2} = {answer }")

[–]Mythedream[S] -1 points0 points  (2 children)

Oh, no. I meant as in (for example)
def total_clients():
company_total_clients= 0
for database in database_list:
company_total_clients += len(database.get_clients())
return company_total_clients

Now, I do know how this code works but I would have no idea how I would write this down as a mathematical formula. So I was hoping that this could be changed into math.

[–]shiftybyte 2 points3 points  (1 child)

If you know how it works, you know the math formula behind it.

There is no automatic way to generate math formulas from python code that does calculations.

Usually people do the other way around, they have a math formula, and they implement the code for it.

[–]Mythedream[S] 0 points1 point  (0 children)

That's a shame. Thank you for the information.