Post

@PythonPr Answer: A) ['a', 'b', 'c']
x += 'c' works like x.extend('c')!
› += iterates through the string 'c'
› Since 'c' has one character, adds 'c' to list
› Result: ['a', 'b', 'c']
For beginners: Try x += 'abc' and you'd get ['a','b','a','b','c'] each char added!
English

@PythonPr Answer is ['a', 'b', 'c'].
To break down the given code:
x = ['a', 'b'] # Initializing a list x with two elements: 'a' and 'b'
x += 'c' # Using the += operator to add 'c' to the list x
print(x) # Printing the updated list x
For More Reference =>>

English

@PythonPr It's definitely not B. The correct choice is not listed in the other three. How do A, C, D differ from each other?
English

@PythonPr ['a','b','c'] but the answer is not in the options
English

@PythonPr x = ['a','b']
x += 'c'
d = 'e'
x+=d+'d'
print(x)
Français















