Python Question / Quiz; What is the output of the following Python code, and why? 🤔🚀 Comment your answers below! 👇 #python #programming #developer #programmer #coding #coder #softwaredeveloper #computerscience #webdev #webdeveloper #webdevelopment #pythonprogramming…
C. Error (TypeError) Strings are immutable. You can't change individual characters. For beginners: › text[1] = 'i' fails › text = text[:1] + 'i' + text[2:] works › text = text.replace('e', 'i', 1) works To modify strings, create a new one!
c) is the answer coz except lists and dictionary, everything is immutable in Python
The answer is (C) First of all 'text' is a string which is immutable (can't be changed after declaring.) Second, 'text[1]' will expect a list which will also through an error.
Strings are immutable, so you cannot change a character of a string like that. Answer C) Error
United States Xu hướng
- 1. Good Sunday 55.6K posts
- 2. Klay 24.1K posts
- 3. McLaren 100K posts
- 4. Lando 133K posts
- 5. #sundayvibes 4,324 posts
- 6. #FelizCumpleañosNico 2,943 posts
- 7. #FelizCumpleañosPresidente 2,824 posts
- 8. #AEWFullGear 72.6K posts
- 9. Ja Morant 11K posts
- 10. Oscar 125K posts
- 11. #LasVegasGP 228K posts
- 12. Piastri 74.1K posts
- 13. Verstappen 103K posts
- 14. Childish Gambino 2,540 posts
- 15. Tottenham 39.3K posts
- 16. Kimi 55.5K posts
- 17. Samoa Joe 5,544 posts
- 18. South Asia 37.3K posts
- 19. Arsenal 160K posts
- 20. Swerve 6,799 posts
Something went wrong.
Something went wrong.