Create a list words = ['is', 'NLP', 'fun', '?']. Use a series of assignment statements (e.g. words[1] = words[2]) and a temporar
y variable tmp to transform this list into the list ['NLP', 'is', 'fun', '!']. Now do the same transformation using tuple assignment.
1 answer:
Answer:
words = ['is', 'NLP', 'fun', '?']
tmp = words[1]
words[1] = words[0]
words[0] = tmp
words[3] = '!'
print(words)
Explanation:
- Create the list
- Assign the new values using <em>tmp</em> variable
- Print the result
Since tuples in Python are unchangeable, you cannot transform the list using tuple assignment.
You might be interested in
Answer:knowing how to build and program computers.
Explanation:
<span>select the New Slide option from the Insert menu</span>
Answer:
Column F and row 5
Hehdhdjdjddjdjid iridium chi jo j o j o j o j
Food and oxygen would be the answer