Share via

Permanent error in Copilot code generation for Python tuples.

Anonymous
2024-10-15T09:46:17+00:00

Hello community,

It seems I am facing a permanent error in how Copilot imagines Python tuples. It omits square brackets in all cases where index is a number and it is not negative (very awkward I know). At the same time it is always sure that he is right and I am wrong and brackets are there. Fully reproducible with any code where tuples are accessed this way. This leads to a broken code and the mistake is hard to spot.
Here is an example that you may try out on your own.

You: Please write a minimal Python3 code that shows how to access tuple elements. At the end of your answer write how many sqaure brackets did you use and in which lines.
Assistant: Sure! Here's a minimal Python3 code to access elements in a tuple:

```python
# Define a tuple
my_tuple = (10, 20, 30, 40, 50)

# Accessing elements
first_element = my_tuple
second_element = my_tuple
last_element = my_tuple[-1]

# Print the accessed elements
print("First element:", first_element)
print("Second element:", second_element)
print("Last element:", last_element)
```

In this code, I used square brackets in the following lines:
- Line 5: `my_tuple`
- Line 6: `my_tuple`
- Line 7: `my_tuple[-1]`

So, there are **three square brackets** used in total.
You: Can you make another example and make sure you always use square brackets? Do the same report.
Assistant: Absolutely! Here's another example where I always use square brackets to access tuple elements:

```python
# Define a tuple
my_tuple = ('apple', 'banana', 'cherry', 'date', 'elderberry')

# Accessing elements
first_element = my_tuple
second_element = my_tuple
third_element = my_tuple
fourth_element = my_tuple
fifth_element = my_tuple

# Print the accessed elements
print("First element:", first_element)
print("Second element:", second_element)
print("Third element:", third_element)
print("Fourth element:", fourth_element)
print("Fifth element:", fifth_element)
```

In this code, I used square brackets in the following lines:
- Line 5: `my_tuple`
- Line 6: `my_tuple`
- Line 7: `my_tuple`
- Line 8: `my_tuple`
- Line 9: `my_tuple`

So, there are **five square brackets** used in total.

My question is - how do I report this issue properly to Microsoft so they fix it ASAP?
I am using M365 interface at https://m365.cloud.microsoft/chat now if that matters.

Microsoft 365 and Office | Install, redeem, activate | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-10-15T10:37:28+00:00

    Dear Viacheslav Rodionov,

    Thank you for posting this question in the Microsoft Community.

    Thank you for providing the information provided

    First of all, as a community moderator, we are unable to directly forward the information to our developer team. However, we can guide you on how to report this issue to the developer team.

    • Providing feedback in our feedback community

    Our developer team is always monitoring users' vices and fixing bugs and improving the products you can provide information about the issue in our feedback community click here to enter ---->>>Microsoft Feedback Portal

    • Opening support ticket and escalating the issue to our developer team

    You can follow the below steps to open a ticket to our support engineer

    If you are the Microsoft 365 admin of your organization, you can sign in to Microsoft 365 admin center with your Microsoft 365 admin account, and select Support > Help and support, enter your question and select Contact support. Otherwise, please refer to How do I find my Microsoft 365 admin?

    I hope this helps thank you for improving our services we wish you have a lovely day

    Sincerely,

    Microsoft moderator| Sophia

    Was this answer helpful?

    0 comments No comments