说明:编写一个程序,接收以英尺和英寸为单位的两块织物的长度(作为整数),并以字符串形式返回总和,格式为:英尺:7 英寸:3(使用https://codingbat链接到网站.com/prob/p267045?parent=/home/bryce.hulett@hotmail.com
总计(5, 11, 1, 4) → '英尺:7 英寸:3'
总计(0、1、1、4)→“英尺:1 英寸:5”
总计(3、6、2、6)→“英尺:6 英寸:0”
代码:
def total(first_f,first_i,second_f,second_i):
inches = (first_i + second_i) % 12
feet = first_f + second_f
additional_f = (first_i + second_i) // 12
total = f'Feet: {feet+additional_f} Inches: {inches}'
return total
我的回报没有得到我需要的输出......我不确定还能做什么,因为它在不同的网站上工作。它说无效的语法错误,但如果我删除导致它显示的“f”
'Feet: {feet+additional_f} Inches: {inches}'
有谁知道如何修理它?