Print and join statement in python

前端 未结 3 793
执念已碎
执念已碎 2021-01-26 11:31

I am newbie to python. I have a sequence and I am able to print it using join method and able to print the length of the sequence separately. I am not able to print

3条回答
  •  醉酒成梦
    2021-01-26 12:16

    seq = ('a', 'b', 'c')
    joined = '-'.join(seq)
    print('The join output is:', joined, 'The length is:', len(seq))
    

    or

    print('The join output is: ' + joined + ' The length is: ' + str(len(seq)))
    

提交回复
热议问题