Python:Write function that returns a tuple with two values in asceding order

The function should return

Could you feedback on below please?

def create tuple():
    return tuple 

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Should your function be called createTuple?
You have typos in the definition and call.

Thank you. Yes. I have edited it to create tuple

It is still wrong.

Here is a ref that explains how to write a function. Notice what comes after the word define…
< How to write a function in Python>

Also this is a list of two tuples . Is that what you wanted it to be?

I want the function to return a tuple containing two values in ascending order . I want to produce


What is the meaning of “produce”?

For eg, does it mean print?

Yes to print, apologies

Okay so then the list of tuples you are creating is not useful?
You can just print the tuples you want?


Hopefully this is a better explanation.

Write a function that takes two positional arguments and returns a tuple containing the two values in ascending order. Assume the values passed are numbers. There is no need to include a check to see if they are valid.

Demonstrate the function working by calling it with (3, 4) and (6, 4) and printing the result of each. It should produce:

(3, 4)
(4, 6)

This part of the description was not reflected at all in your code.

Start by writing a simply function, give it a good name that reflects its purpose and that takes the arguments mentioned.

1 Like

Hi there,

I am not sure why you decided to spoil the solution.
I would think you would know that doing that also spoils the learning process.

Okay I am deleting it!

1 Like

Perhaps you can help another way?

Yah I Must use some other way.