In one of my practice sessions I got a code challenge the prompt is " Write a function called largest_number that takes three integer inputs, x , y , and z . Have this function, as its name implies, return the largest of the three numbers."

When I enter my code it says “‘list’ object is not callable”

Here is my code`
x = 3
y = 1
z = 2

intlist = x, y, z
allnums = list(intlist)
allnums.sort()
largest_number = allnums[-1:]
print(largest_number)`

If you could, please help me it would be very much appreciated.

The instructions specify “Write a function called largest_number that takes three integer inputs”
You haven’t defined a function largest_number. You have assigned a value to a variable largest_number. Instead, largest_number should be a function with three parameters.

The instructions specify “return the largest of the three numbers”. The largest_number function should return a number, not a list.
You are creating a slice of the list, instead of using indexing to select the last element. For example,

Rewrite your code so that largest_number is a function with three parameters. After figuring out the largest number, the function should return that number. The returned number shouldn’t be in a list.