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

Suppose there is class of 30 students who have attendance between 40-



100%. The university has decided to give the bonus attendance between



for those students who have the attendance between 70-74% to make it



75%. Identify the students those have attendance after adding the bonus



attendance. Suppose students have its Roll_no & attendance. Add the



bonus attendance to the obtained final attendance of student through



array. Use functions to solve this tasks.



Input Format



The input should contain a roll_no, and attendance of 25 students.



Output Format



For each test case, display the roll_no and increased attendance of those



students only who lies between the obtained attendance of 70-74%.

If you are trying to print a string, what happens if you leave out one of the quotation marks or both and why?


ACT2: Object Basics (copy)


INSTRUCTIONS


Create a class called Numbers, which has a single class attribute called MULTIPLIER, and a constructor which

takes the parameters x and y (these should all be numbers).



(a) Write a method called add which returns the sum of the attributes x and y.


(b) Write a class method called multiply, which takes a single number parameter a and returns the product

of a and MULTIPLIER.


(c) Write a static method called subtract, which takes two number parameters, b and c, and returns b - c.


(d) Write a method called value which returns a tuple containing the values of x and y. Make this method

into a property, and write a setter and a deleter for manipulating the values of x and y.



Reduce the digits:



You are given a positive integer N, write a program to repeatedly add the digits of the number until the number becomes a single-digit number.



Input:



The input should be a single line containing a single-digit number.



Output:



The output should be a single line containing a single-digit number.



Explanation:



In the example, the given number is 92. As the number is more than a single digit, repeatedly add the digits like



9+2=11



1+1=2

Profit Trade:



You are given a list of prices, where prices[i] is the price of the given stock on the i th day. Write a program to print the maximum profit by choosing a single day to buy a stock and choosing a different day in the future to sell that stock. If there is no profit that can be achieved, return 0.



Input:



The input should be a single line containing space-separated integers.



Output:



The output should be a integer.



Explanation:



In the example, the given prices are 7,1,5,3,6,4



Buying stocks on day two having price 1 and selling them on the fifth day having price 6 would give the maximum profit which is 6-1



So the output should be 5.

closest even digits number:


Given an integer N, write a program to print the closest number that has all the even digits. Consider the lowest number if there is same difference between forward and backward numbers.


Input:


The input is a single line containing an integer N.


Output:


The output should be a single line containing the closest integer , that has all even digits.


Explanation:


In the example, the number is 17. The closest number that has all even digits in it is 20. So the output should be 20.

Weekends

Given two dates D1 and D2, write a program to count the number of Saturdays and Sundays from D1 to D2 (including D1 and D2).

The date in string format is like "8 Feb 2021".Input


The first line of input will contain date D1 in the string format.

The second line of input will contain date D2 in the string format.Output


The output should be a single line containing two integers separated by space.Explanation


For example, if the given dates are "25 Jan 2021" and "14 Feb 2021", the Saturdays and Sundays dates from "25 Jan 2021" to "14 Feb 2021" are

"30 Jan 2021" is a Saturday

"31 Jan 2021" is a Sunday

"6 Feb 2021" is a Saturday

"7 Feb 2021" is a Sunday

"13 Feb 2021" is a Saturday

"14 Feb 2021" is a Sunday

So the output should be

Saturday: 3

Sunday: 3

Sample Input 1

25 Jan 2021

14 Feb 2021

Sample Output 1

Saturday: 3

Sunday: 3


Consider a schedule with 4 transactions with 1, 2, 3, and 4 operations respectively. Calculate the possible



number of



a) Serial schedules



b) Non serial schedules

Consider the following relation with set of functional dependencies



R(ABCDEF)



ABC->D, ABD->E, CD->F, CDF->B, BF->D



a) Identify the candidate key(s) in the relation (with proper steps followed).



b) Identify which normal form this relation is in and reason for the answer.

in the example the first test case number is 9966777819 and this number should be divided into 4 3 3 format

the first divided part should be read a double nine double six. As there are two consecutive 9's,it should be read as double nine.similarly there are two consecutive 6's it should be read as double six

in the second divided part there are three consecutive 7's it should be read as triple seven.

In the third divided part there are no consecutive digits each digit should be read separately.

sample input1

9966777819

sample output1

double nine double six triple seven eight one nine

sample input 2

7299613014

sample output 2

seven two double nine six one three zero one four


LATEST TUTORIALS
APPROVED BY CLIENTS