a = int(input("enter an integer. "))
b = int(input("enter an integer. "))
def sortedTuple(a,b):
sorted(sortedTuple)
print(sortedTuple(a,b))
#Write the 'sortedTuple' function to return
# a tuple ( a,b ) or ( b,a ), such that the first value in the tuple
# is the larger of the two.
#Then uncomment the function call above to test your function
I tried adding many things but I never got the program to run properly.
I always got ” ‘function’ object is not iterable” when I expected the tuples to sort and present themselves in descending order with the larger integer first.
EpicMU1030 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3
You’re not creating a tuple in your code, and you’re only calling sorted() on your function “sortedTuple”, which is not iterable; that’s why you get the ‘function’ object is not iterable. You can create the tuple of a and b first, then call sorted() on that. However, you’ll have to research the sorted function to make sure the larger value is first.
Phillips Olagunju is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.