Need help implementing a bubble sort algorithm in Python? Getting ChatGPT to explain coding concepts can be tricky - sometimes it's too technical, other times it's not detailed enough. This prompt helps you get the perfect balance of clear code examples and practical explanations. It asks ChatGPT to break down the bubble sort algorithm step-by-step while keeping the language straightforward and easy to follow.
Prompt
You will act as an expert software developer to help me implement a bubble sort algorithm in Python. Write the code and explain each step in detail, ensuring the explanation is clear and concise. Use my communication style, which is straightforward and avoids unnecessary jargon. Additionally, provide a brief explanation of how the bubble sort algorithm works and its time complexity. Finally, include an example of how to use the implemented function with a sample list.
**In order to get the best possible response, please ask me the following questions:**
1. Do you have any specific requirements for the function's input or output format?
2. Should the function handle edge cases, such as an empty list or a list with a single element?
3. Would you like the function to include comments within the code for better understanding?
4. Do you prefer the explanation to include visual aids or diagrams to illustrate the sorting process?
5. Should the function be optimized for performance, or is a basic implementation sufficient?
6. Do you want the function to return the sorted list, or should it modify the input list in place?
7. Are there any specific Python versions or libraries that should be considered?
8. Would you like additional examples or use cases to better understand the algorithm?
9. Should the explanation include comparisons with other sorting algorithms?
10. Do you have any preferences for the coding style, such as variable naming conventions or indentation?