【发布时间】:2023-03-21 03:00:02
【问题描述】:
我有一个 GCSE 问题,Python 要求我在一个函数中输入三个数字并打印最大的一个。
我的问题是,它显示错误Can't convert int to str implicity。
inputed_1 = int(input("Give me a number: "))
inputed_2 = int(input("Give me another number: "))
inputed_3 = int(input("Give me another number: "))
def largest(num1, num2, num3):
if num1 > num2 and num1 > num3:
print("Your first number was the largest: " + num1)
elif num2 > num1 and num2 > num3:
print("Your second number was the largest: " + num2)
elif num3 > num1 and num3 > num2:
print("Your third number was the largest: " + num3)
largest(inputed_1, inputed_2, inputed_3)
【问题讨论】:
标签: python implicit-conversion