harshra215 / Exppython

1 stars 0 forks source link

Tuples aren't working in Long format codes #1

Open harshra215 opened 11 months ago

harshra215 commented 11 months ago

Tuples code isn't working in python program when I am comparing with others code pls help me with this issue.

Lilneo786 commented 11 months ago

Syntax Errors: make sure that your tuple syntax is correct. Tuples are created using parentheses () or even without them, separated by commas.

my_tuple = (1, 2, 3)
another_tuple = 4, 5, 6

To access elements in a tuple, use indexing, starting from 0. For example:

my_tuple = (1, 2, 3)
first_element = my_tuple[0]  # Accesses the first element (1)

Tuple packing and unpacking:

# Tuple packing
my_tuple = 1, 2, 3

# Tuple unpacking
a, b, c = my_tuple

If you can provide a specific example of code that isn't working with tuples, along with the error message or undesired behavior you're encountering, I can take a look.