(三)基础代谢率bmr的计算3.0---字符串分割、格式化输出

字符串操作补充: • 字符串分割 str.split(), https://docs.python.org/3/library/stdtypes.html#st

字符串操作补充:
• 字符串分割
str.split(), https://docs.python.org/3/library/stdtypes.html#str.split
• 字符串格式化输出,使用{}占位
str.format()
如:
‘{}公斤, {}厘米’.format(70, 175)
重复输出时可以使用数字标记顺序
‘{0}公斤, {1}厘米, {0}公斤’.format(70, 175)

"""
基础代谢率bmr的计算3.0
马玉华 2019.7.24
实现字符串和数字间的转换。
程序运行直到用户选择退出。
3.0新增:用一行把所有信息输入
3.0新增:输出的结果带单位
"""def main():y_or_n = 'n'while y_or_n == 'n':# #性别# gender = input('请输入性别:')# print(type(gender))   #此处输出type(参数)可以知道参数的类型# #体重# weight = float(input('请输入体重(KG):'))      #将输入的str字符串型转换成float浮点型# print(type(weight))    #输出weight的类型# #身高# height = float(input('请输入身高(cm):'))    #转换成浮点型# #年龄# age = int(input(&#