joelle joelle - 1 year ago 116
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))

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download