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
SOVA2 [1]
4 years ago
14

1i) Standardize 'weight' column Write a function named standardize_weight that takes in as input a string and returns an integer

. The function will do the following (in the order specified): 1) convert all characters of the string into lowercase 2) strip the string of all leading and trailing whitespace 3) replace any occurences of 'lbs' with '' (remove it from the string) 4) replace any occurences of 'lb' with '' (remove it from the string)
Computers and Technology
1 answer:
jeka57 [31]4 years ago
4 0

Answer:

import numpy as np

def standardize_weight(inp):

#1

inp=inp.lower()

print(inp)

#2

inp=inp.strip()

print(inp)

#3

inp=inp.replace("lbs"," ")

print(inp)

#4

inp=inp.replace("lb"," ")

print(inp)

#5

inp=inp.replace("pounds"," ")

print(inp)

 

print(inp.find("kg"))

#6

if(inp.find("kg")>=0):

inp=inp.replace("kg"," ")

print(inp)

inp_int=int(inp)

print(inp_int*2)

inp=str(inp_int)

print(inp)

#7

inp=inp.strip()

print(inp)

#8

if(inp.isdigit()):

inp=int(inp)

#9

else:

inp=np.nan

 

res=standardize_weight(" List albkg repLacleg sublkg " )

Explanation:

You might be interested in
If you commit license fraud by using an altered or unlawful license:
Scorpion4ik [409]
<h2>Answer:</h2>

All of these

<h2>Explanation:</h2>

If someone is caught with a fake or altered or unlawful driving license, the law will come in action and the person can be sent to jail for it. He may be fined for an amount depending upon the state law. His driving privilege can also be suspended automatically in some states and the false license will be confiscated so that no one could be able to use it again in any circumstances.

5 0
3 years ago
Read 2 more answers
Write a method named numUnique that accepts a sorted array of integers as a parameter and that returns the number of unique valu
SVEN [57.7K]

Answer:

The method in Java is as follows:

public static int numUnique(int list[]) {  

int unique = 1;  

for (int i = 1; i < list.length; i++) {  

 int j = 0;  

 for (j = 0; j < i; j++) {

  if (list[i] == list[j])  

   break;  

 }

 if (i == j)  

  unique++;  

}  

return unique;  

}  

Explanation:

This line defines the numUnique method

public static int numUnique(int list[]) {

This initializes the number of unique elements to 1

int unique = 1;  

This iterates through the list

for (int i = 1; i < list.length; i++) {

The following iteration checks for unique items

 int j = 0;  

<em>  for (j = 0; j < i; j++) { </em>

<em>   if (list[i] == list[j]) </em><em>If current element is unique, break the iteration</em><em> </em>

<em>    break;  </em>

<em>  } </em>

 if (i == j)  

  unique++;  

}

This returns the number of unique items in the list

return unique;  

}  

3 0
3 years ago
In Java :
Natali5045456 [20]

Answer:

The code to this question can be given as:

Code:

//define code.

//conditional statements.

   if (Character.isLetter(passCode.charAt(0))) //if block

   {

       System.out.println("Alphabetic at 0"); //print message.

   }

   if (Character.isLetter(passCode.charAt(1))) //if block

   {

       System.out.println("Alphabetic at 1"); //print message.

   }

Explanation:

In this code, we define conditional statement and we use two if blocks. In both if blocks we use isLetter() function and charAt() function. The isLetter() function checks the inserted value is letter or not inside this function we use charAt() function that checks inserted value index 1 and 2 is the character or not.

  • In first if block we pass the user input value and check the condition that if the inserted value is a character and its index is 0 so, it will print Alphabetic at 0.
  • In second if block we pass the user input value and check the condition that if the inserted value is a character and its index is 1 so, it will print Alphabetic at 1.
5 0
3 years ago
Which type of financial institution typically has membership requirements?
Anon25 [30]
Credit Union typically has membership requirements
8 0
4 years ago
Jason logged into a banking website. A few later, he found that money from his account had been transferred to another account w
NemiM [27]
I think it’s bank fraud or cybercrime idk
8 0
3 years ago
Other questions:
  • At the end of your presentation, the main points should be a. Summarized c. Handed to your teacher b. Written on the board d. Re
    7·2 answers
  • Rearrange the statements in the following order so that the program prompts the user to input: a. The height of the base of a cy
    12·1 answer
  • Which country does coriander come from
    11·2 answers
  • A 10MB file is compressed into a 2MB file for storage. What is the compression ratio?
    6·1 answer
  • State two functions of windows environment​
    9·1 answer
  • List the six external peripheral parts of a computer system
    8·1 answer
  • A(n) _____ describes your core values and highest career goals. A. résumé B. objective statement C. qualifications profile D. pe
    7·2 answers
  • Why RAM is necessary in a computer​
    9·1 answer
  • Mr. O would like to purchase a new computer for his home business. Mr. O's current computer runs very slow when he is running e-
    5·2 answers
  • What is computer forensics? Where and how would an IT auditor use thisresource?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!