Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Find out the mean, median and standard deviation of this numpy array -> np.array([1,5,3,100,4,48])
How to create a new column in pandas by using values from other columns?
We can perform column based mathematical operations on a pandas dataframe. Pandas columns containing numeric values can be operated upon by operators.

Code

import pandas as pd
a=[1,2,3]
b=[2,3,5]
d={"col1":a,"col2":b}
df=pd.DataFrame(d)
df["Sum"]=df["col1"]+df["col2"]
df["Difference"]=df["col1"]-df["col2"]
How to create a new column in pandas by using values from other columns?
We can perform column based mathematical operations on a pandas dataframe. Pandas columns containing numeric values can be operated upon by operators.

This problem is related to the virtual learning environment application discussed in one theory session and a few practicals. In this problem, you are tasked with creating and updating learner profiles, a particular type of user. As well, given a learner profile, we would like to retrieve the learning materials in the form of topics. Note that the learning materials for a given course will differ from one learner profile to another. For example, for a course "Distributed Systems and Applications", the learning materials for a learner with a weak background in "Programming" compared o another learner profile with a stronger background in programming.

Your task is to:

1. Provide a description in OpenAPI of the API that allows for communication between a client and a service for the functionalities discussed above;

2. Implement a corresponding client and a service. 


  1. A palindrome is a word or a phrase that reads the same way backwards as forwards. Write a function that accepts a text string as input and determines whether or not the text string is a palindrome. Then write a program that uses this function. Prompt the user to enter a word or phrase and then inform the user whether or not the text entered qualifies as a palindrome. [Hint: there is a REVERSE method for a string. But to compare an string reversed this way, you need to convert to list: if list(str) == list(rev_str):]

Given an integer between 0 and 10000, write a program to print the sum of its digits.Input


The first line of input will contain an integer.Output


The first line of output should be the sum of the digits.Explanation


For example, if the given number is 25, your code should print the sum of the digits (2 + 5), which is 7.


Similarly, if the given number is 692, your code should print the sum of the digits (6 + 9 + 2), which is 17.


Similarly, if the given number is 9999, your code should print the sum of the digits (9 + 9 + 9 + 9), which is 36.

Sample Input 1

25

Sample Output 1

7

Sample Input 2

692

Sample Output 2

17

Sample Input 3

9999

Sample Output 3

36



Python 3.9


RESET




Write a program for Horizon Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and then recommend the best plan for the customer's needs. A customer who needs fewer than 500 minutes of talk and no text or data should accept Plan A at $49 per month. A customer who needs fewer than 500 minutes of talk and any text messages should accept Plan B at $55 per month. A customer who needs 500 or more minutes of talk and no data should accept either Plan C for up to 100 text messages at $61 per month or Plan D for 100 text messages or more at $70 per month. A customer who needs any data should accept Plan E for up to 2 gigabytes at $79 or Plan F for 2 gigabytes or more at $87.



#Loop through the prices in levelsList.
#During each loop:
#-Create a variable called priceLevelLabel consisting of the text 'Price Level: 'followed
# by the price.
#-Add priceLevelLabel and the price as two separate items to a new list (the sub-List).
#-Append the sub-List to displayList.
for price in self.levelsList:


# Create displayList

    displayList = []

# Loop through the prices in levelsList.

 # During each loop:

 # - Create a variable called priceLevelLabel consisting of the text 'Price Level:  '

followed by the price.     

# - Add priceLevelLabel and the price as two separate items to a new list (the sub-List).     

# - Append the sub-List to displayList. for price in self.levelsList:

 . . .

 # Create a variable called previousPriceLabel consisting of the text 'Previous Price: ' followed 

# by previousPrice. # Add previousPriceLabel and previousPrice as two separate items to a new list (the sub-List).  # Append the sub-List to displayList.

. . .

# replace ellipsis with applicable cod


#During the first loop of this method, previousPrice will still be 0 here,
#because it was set to currentPrice above, which also was 0 before we updated
#it above via getBitMexPrice().
#So, when we reach this point during the first loop, previousPrice will be 0
#while currentPrice would have just been updated via getBitMexPrice().
#We don't want to create the impression that the price shot up from 0 to
#currentPrice.
#ThereFore, if previousPrice == 0.0, it must be set equal to currentPrice here.

Add two polynomials


Given two polynomials A and B, write a program that adds the given two polynomials A and B.


Input


The first line contains a single integer M.


Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A After that next line contains a single integer N. Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.


I am not getting proper output


LATEST TUTORIALS
APPROVED BY CLIENTS