Python Answers

Questions answered by Experts: 5 288

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

Let A=[4, 5, 6, 5, 3, 2, 8, 0, 4, 6, 7, 8, 4, 5, 8, 9, 8, 6, 8, 5, 5, 4, 2, 1, 9, 3, 3, 4, 6, 4] be a list. You need to write a python function Create_List(A) to create a new two-dimensional list B=[[ , ], [ , ], ...., [ , ]] such that for an element [x, y] in B, x denote a value of an element in A and y denotes how many times x appeared in list A. The function Create_List (A) will take list A as input and return list B as an output




NOTE:




Do not use the input() function for taking input from the keyboard. Specify the input in fixed form but function must be generalized that can work with values.



you are not allowed to use extra lists other than A and B. Further, no predefined functions are allowed except len(), and append().

The volume of a sphere is 4/3πr3, where π has the value of "pi" given in Section 2.1 of your textbook. Write a function called print_volume (r) that takes an argument for the radius of the sphere, and prints the volume of the sphere.


Call your print_volume function three times with different values for radius.


Include all of the following in your Learning Journal:


The code for your print_volume function.

The inputs and outputs to three calls of your print_volume.


Part 2


Write your own function that illustrates a feature that you learned in this unit. The function must take at least one argument. The function should be your own creation, not copied from any other source. Do not copy a function from your textbook or the Internet.


Include all of the following in your Learning Journal:


The code for the function that you invented.

The inputs and outputs to three calls of your invented function.

A description of what feature(s) your function illustrates.


Date format-2 expalin code sum getting error

Date format-2

 

1.    After imputation of nulls with mean what is the average value of the compressive strength in concrete?

2.    The feature that has a moderately strong relationship with compressive strength in concrete is?

3.    Standardize the dataset using standardscaler(), split the dataset into train and test of proportions 70:30 and set the random state to 1. Build a Linear Regression Model on the data and the resulting r-squared value is between which range?


Write the code to test if the variables num1 and num2 are not the same


Give seconds as input,write a program to print in D days H hours M minutes S seconds


Input 200


Output 3 minutes 20seconds


Input 86400


Output 1 day

Consider a mx n matrix inmatrix of string elements containing alphanumeric values, where m>1, n >=1. Identify and print outarr based on the logic below:





• Traverse the inmatrix in clockwise spiral way starting from the element at (0,0) •





traversal until one of the two conditions is met • The element or the concatenated string is a palindrome with length greater





than 1 There are no more elements left for traversal





. Add the concatenated string to outarr





. If there is any element which has not yet been visited in the traversal, repeat the two steps, forming a new concatenated string that starts with the next element present after the last element previously traversed





Note: Perform case-sensitive comparison





Input format:





First line will contain number of rows m of inmatrix





The next m lines will contain the elements of inmatrix. Each line will have n string





elements separated by (comma)

Consider a relation train with attributes trainid (Primary Key), trainname, traintype, noofcoaches, source and destination. Except trainid, no columns am The table has following 3 indexes created:




IX1-trainname, source




IX2- trainname, destination




IX3 noofcoaches




Which of the following will NOT use index?

SELECT customername FROM customer c, mobile m, purchase p WHERE p.mobileidm.mobileid AND c.customerid = p.customerid AND p.customerid IN (SELECT customerid FROM purchase GROUP BY customerid HAVING #SPACE1=(SELECT #SPACE2 FROM purchase GROUP BY customerid)) AND price> 40000;




8




9




11




What should be written at #SPACE1 and #SPACE2 respectively in the query given above to get John, Jack and Maria in the output?

LATEST TUTORIALS
APPROVED BY CLIENTS