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
Fittoniya [83]
3 years ago
8

Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write yo

ur code so that it works no matter how many items are in the list
Computers and Technology
1 answer:
defon3 years ago
7 0

Answer:

sports = ["football", "basketball", "volleyball", "baseball", "swimming"]

last = sports[-3:]

print(last)

Explanation:

*The code is in Python.

Create a list called sports

Create a variable called last and set it to the last three elements of the sports list using slicing

Print the last

You might be interested in
Recall that within our BinarySearchTree class the root variable is of type BSTNode. A BSTNode object has three attributes: info
shutvik [7]

Answer:

False ( A )

Explanation:

The implementation is incorrect hence the return would be false and this is because : root.left is supposed to be NULL, root.right is supposed to be NULL and when  these conditions are met then the Binary tree would be empty.

The condition for the above statement would be represented as

if( root.left = = null && root.right == null &&root.info == null)

return true;

else

return false;

7 0
2 years ago
Create a java class for Bank Accounts with these public String attributes: ownerName, acctNbr and these private double attribute
Readme [11.4K]

Answer:

public class BankAccounts

 {

   public String ownerName;

   public String acctNbr;

   private double debits;

   private double credits;

   public BankAccounts(String ownerNm, String acNum)

  {

    debits = 0;

    credits = 0;

    ownerName = ownerNm;

    acctNbr = acNum;

  }

public void addDebit(double debitAmt)

  {

    if(credits > (debits + debitAmt))

      debits = debits + debitAmt;

    else

      System.out.println("Insufficient balance");

}

   public void addCredit(double creditAmt)

  {

    credits = credits + creditAmt;

  }

public double getBalance()

  {

    double balance = 0;

    if((credits - debits) > 0)   // return the value if there is actually some balance left.

      balance = credits - debits;

    return balance;   //returns 0 if credits are lesser or equal to debits

  }

 }

Explanation:

Here class name is <em>BankAccounts </em>which can be used to create a new bank account whenever any user wants to open a bank account. This class will help to track any new account opening, debits and credits operations carried out on that account.

We have a constructor here, which accepts 2 arguments i.e. Bank account <em>Owner Name</em> and <em>Account Number</em>. The constructor also sets the values of <em>debits </em>and <em>credits</em> as 0.

The methods <em>addDebit()</em>, <em>addCredit()</em> and <em>getBalance()</em> help to perform Debit and Credit operations on the account.

NOTE: The method <em>getBalance()</em> returns a positive value only when credits are greater than debits.

The method <em>addDebits()</em> can add debits only as the condition that the credits are greater than the resultant debits.

The code for class <em>BankAccounts</em> is hereby attached.

Download java
4 0
3 years ago
In the context of the box model, what is the difference between a margin and padding
Andrej [43]

Answer:

It is good to know about the differences between margin and padding .Margin is the outer space of an element, while padding is the inner space of an element. In other words, margin is the space outside of an element's border, while padding is the space inside of its border. You can set auto value to margin.

3 0
3 years ago
How does inertia affect a person who is not wearing a seatbelt during a collision
disa [49]
Inertia would keep them going the same speed as the car was going. therefore, the person not wearing a seatbelt would be sent flying forward, probably ending up dead
8 0
3 years ago
Jackson builders is constructing new homes in the Parkway subdivision.The company needs the logic for an application that ncalls
lord [1]
<span>The calculatePrice() method can be written in C. It will use and return doubles (which allows for decimals). It will calculate the house price of $100K + $20K per bedroom and $30K per bathroom. Next it will take that price and append the sales percentage and return that value.
double calculatePrice(decimal numBedrooms, decimal numBathrooms, decimal salesPercentage)
{
decimal housePrice = 100000 + (20000 * numBedrooms) + (30000 * numBathrooms);
return housePrice + (housePrice * salesPercentage);
}</span>
8 0
3 years ago
Other questions:
  • Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of
    14·1 answer
  • Write a function named delete Letter that has 2 parameters. The first parameter is a string, the second parameter is an integer.
    11·1 answer
  • In regards to storing folders the computer can be described as a ________________.
    7·1 answer
  • You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
    5·1 answer
  • Who were called “freedmen” during the reconstruction period?
    15·2 answers
  • What lets you do many things, like write book reports and stories?
    15·1 answer
  • Which wildcard characters will return a single character when using the Find dialog box?
    6·2 answers
  • Overlay analysis is ____________, taking in data from two or more layers to create a single output layer.
    5·1 answer
  • What word can you type using only the left home row keys and the right reach keys?
    6·2 answers
  • How are comments in a Java program treated by the compiler?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!