python基础问题,用def函数解决

问题:编写一个名为NWH的函数,该函数接收一个字符串和两个浮点数。函数应该返回一个元组,其中包含大写的字符串参数和四舍五入到小数点后1位的两个浮点数。

形式:
def NWH():
str1=input()
num1=float(input())
num2=float(input())

def NWH(s, n1, n2):
    return s.upper(), round(n1, 1), round(n2, 1)
    
str1=input(">>>")
num1=float(input(">>>"))
num2=float(input(">>>"))

print(NWH(str1, num1, num2))


def NWH(string, float_x, float_y):
    return string.upper(), round(float_x, 1), round(float_y, 1)

result = NWH("hElLo", 2.3333, 5.6666)
print(result)

>>> ('HELLO', 2.3, 5.7)