0

Can anyone tell me what shall I do about the unnecessary commas and apostrophe in the output?

https://code.sololearn.com/ciRTF7ESv1Zy/?ref=app

25th Apr 2022, 1:57 PM
Kaushik
Kaushik - avatar
3 Antworten
+ 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))
25th Apr 2022, 2:01 PM
Lisa
Lisa - avatar
+ 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))
25th Apr 2022, 3:22 PM
Lothar
Lothar - avatar
+ 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.
25th Apr 2022, 3:31 PM
Lisa
Lisa - avatar