joelle joelle - 9 months ago 63
Python Question

Python basic result format

def meter_to_cm(m):
cm = m * 10
print(m,'m equals to',cm,'cm')


The result shows

(12, 'm equals to', 120, 'cm')

How can I make it do not show the parentheses, quotes and commas?

Answer Source

For Python 3, use following

def meter_to_cm(m):
    cm = m * 100
    print("{0} m equals to {1} cm".format(m, cm))