0
Can anyone tell me what shall I do about the unnecessary commas and apostrophe in the output?
3 Réponses
+ 3
"a" is a tuple of strings and numbers.
You could just construct a string out of it or print it by unpacking the tuple:
print(*Mixed(num,num1))
+ 2
Kaushik ,
from my point of view using an f-string for generating the output string is more clear and has a better readability. doing so, we can also omit the unpack operator:
...
a = f"The mixed fraction of {num} and {num1} is {Quotient} and {Remainder} / {num1}"
...
print(Mixed(num,num1))
+ 1
In addition to Lothar comment: It would probably be even better to separate calculations and output formatting.
Let your function only return the 2 numbers and do the formatting inside of the print function.