1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Brrunno [24]
3 years ago
12

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.
Computers and Technology
1 answer:
Svetlanka [38]3 years ago
5 0

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
Write a program in Java programming language that given two clock times prints out the absolute number of minutes between them
Triss [41]

Answer:

// Java Program to Find the difference

// between Two Time Periods

// Importing the Date Class from the util package

import java.util.*;

// Importing the SimpleDateFormat

// Class from the text package

import java.text.*;

public class GFG {

public static void main(String[] args) throws Exception

{

 // Dates to be parsed

 String time1 = "18:00:00";

 String time2 = "7:30:50";

 // Creating a SimpleDateFormat object

 // to parse time in the format HH:MM:SS

 SimpleDateFormat simpleDateFormat

  = new SimpleDateFormat("HH:mm:ss");

 // Parsing the Time Period

 Date date1 = simpleDateFormat.parse(time1);

 Date date2 = simpleDateFormat.parse(time2);

 // Calculating the difference in milliseconds

 long differenceInMilliSeconds

  = Math.abs(date2.getTime() - date1.getTime());

 // Calculating the difference in Hours

 long differenceInHours

  = (differenceInMilliSeconds / (60 * 60 * 1000))

  % 24;

 // Calculating the difference in Minutes

 long differenceInMinutes

  = (differenceInMilliSeconds / (60 * 1000)) % 60;

 // Calculating the difference in Seconds

 long differenceInSeconds

  = (differenceInMilliSeconds / 1000) % 60;

 // Printing the answer

 System.out.println(

  "Difference is " + differenceInHours + " hours "

  + differenceInMinutes + " minutes "

  + differenceInSeconds + " Seconds. ");

}

}

7 0
2 years ago
Please add thenodes given below to construct the AVL tree show all the necessarysteps,
Paha777 [63]

Answer:

30,33,37,18,23,34,15,38,40,17

To construct the AVL tree, follow these steps and diagrams are shown in the image:

• Add 30 to the tree as the root node. Then add 33 as the right child because of 33 is greater than 30 and AVL tree is a binary search tree.

• Then add 37 as the right child of 33. Here the balance factor of node 30 becomes 0-2 = -2, unbalanced.

Use RR rotation, make node 33 the root node, 30 as the left child of 33 and 37 as the right child of 33.

• Now add 18 as the left child of 30. And 23 as the right child of 18. Here the balance factor of 30 becomes 2-0 = 2. It’s unbalanced.

Use LR rotation, make 23 the parent of 18 and 30.  

• Now add 34 as the left child of 37 and 15 as the left child of 18. Add 38 as the right child of 37. And then add 40 as the right child of 38.

• Now adding 17 as the right child of 15 makes the tree unbalanced at 18.

Use LR rotation, make 17 as the parent of 15 and 18.

Explanation:

The balance factor of a node can be either 0,1 or -1. Else the tree is called unbalanced at the node.

If the inserted node is in the left subtree of the left subtree of the unbalance node, then perform LL rotation.

If the inserted node is in the right subtree of the right subtree of the unbalance node, then perform RR rotation.

If the inserted node is in the left subtree of the right subtree of the unbalance node, then perform RL rotation.

If the inserted node is in the right subtree of the left subtree of the unbalance node, then perform LR rotation.

7 0
2 years ago
Can somebody help me with this plzzz, I watched the video but I don’t got it :’(
krek1111 [17]

Answer:

n,

Explanation:

4 0
3 years ago
Read 2 more answers
Assign True to the variable has_dups if the string s1 has any duplicate character (that is if any character appears more than on
podryga [215]

Answer:

#include <iostream>

using namespace std;

int main()

{

   string s;

   cin>>s;    //reading string

   int i,j;

   bool has_dups=false;

   int n= s.length();

   for(i=0;i<n;i++)  //to check for duplicate characters

   {

       for(j=0;j<n;j++)

       {

           if(j!=i && s[i]==s[j])  //to check if it is matched with itself

           {

               has_dups=true;  //if true no need to check others

               break;

           }

       }

   }

   cout<<has_dups;

   return 0;

}

OUTPUT :

California

1

Explanation:

Above program finds if a character repeat itself in the string entered by user.

4 0
3 years ago
Discuss three ways you could (or currently do) use the Excel software in your personal or professional life. Provide examples an
professor190 [17]
Both in my personal and professional life, I use the Excel software in order to create tables and lists. It's much easier to do that in Excel rather than in Word, for example, because Excel was actually created for that purpose, whereas Word was created for writing, above all. I use Excel for work to create tables of various things, such as names, emails, payments, etc. whereas I use it in my personal life to create lists of things such as movies, books, etc.
3 0
3 years ago
Other questions:
  • This technology was developed in the 1980s and was a successful attempt to provide services for voice, video, and video traffic
    11·1 answer
  • There is a flashing yellow light at the intersection you are approaching. What does the flashing yellow light indicate, and what
    8·1 answer
  • A user deletes a message from a mailbox while on a desktop. What happens to the email message on the user's synchronized devices
    13·2 answers
  • What were the technological innovations that allowed for the rapid expansion of the railroads?
    6·1 answer
  • An effective team would never have ______.
    13·1 answer
  • How was kapilvastu named​
    11·1 answer
  • Please Complete in Java a. Create a class named Book that has 5 fields variables: a stock number, author, title, price, and numb
    10·1 answer
  • Which influence on spending deals with the motivation to<br> purchase a product?
    12·1 answer
  • What are the cloud storage components
    6·1 answer
  • a value-returning method must specify as its return type in the method header. question 18 options: a) an int b) a double c) a b
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!