Ask Question
18 September, 07:06

Create a list words = ['is', 'NLP', 'fun', '?']. Use a series of assignment statements (e. g. words[1] = words[2]) and a temporary variable tmp to transform this list into the list ['NLP', 'is', 'fun', '!']. Now do the same transformation using tuple assignment.

+5
Answers (1)
  1. 18 September, 10:25
    0
    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 tmp variable

    - Print the result

    Since tuples in Python are unchangeable, you cannot transform the list using tuple assignment.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Create a list words = ['is', 'NLP', 'fun', '?']. Use a series of assignment statements (e. g. words[1] = words[2]) and a temporary variable ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers