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.
Create a program wherein the library system should be able to collect fines for books returned after the due date.
Radioactive decay of radioactive materials can be modeled by the equation π΄ = π΄0π
βπ‘(ln 2ββ), where
A is the amount of the material at time t, A0 is the amount at time 0, and h is the half-life.
Technetium-99 is a radioisotope that is used in imaging of the brain. It has a half-life of 6
hours. Your program should display the relative amount A/A0 in a patient body every hour for 24
hours after receiving a dose.
Note: With the aid of formatting techniques documented in your note, ensure your program output
matches that given below
Find latitude and longitude of first 20 countries with a population greater than or equal to the population limit given below. Use the country details from this dataset.
Your task is to find the sum of the length of all lines (in kms) that can be drawn between co-ordinates of these countries.
Assume radius of earth: 6371 km
Round length of each line and final result to 2 decimal points
If co-ordinates are missing for any country use 0.000 N 0.000 E
Population limit: 300
Note: Population limit will change at random intervals.
Answer:
finding difference
Write a Python program to access the Furniture spreadsheet, update the price of tables, and then create a new excel spreadsheet called updatedfurniture. Create a dictionary for the price updates and update the prices via a loop, increasing the row number to include all the rows in the spreadsheet. Do not change the formatting of the original spreadsheet. Be sure to check your updatedFurniture spreadsheet to verify that the Total price of the furniture increased. The new Total price amount should be $273,938.20.
class User :
def __int__(self, user_id, username):
self.id = user_id
self.username = username
user_1 = User("001", "allobang")
print(user_1.username)
user_2 = User("002", "Jack")
print(user_2.username)
ACTIVITIES:
1. Finish this code by adding a password attribute.
2. Assign passwords on user_1 and user_2 of your choice.
3. Create 3rd user object.
a. The value of the id should be your student ID number.
b. The value of username should be your first name.
c. Assign the value of the password attribute of your choice.
4. Print the username of 3rd user object.
PYTHON CREATING CLASS AND ATTRIBUTE :
1. Create a Class and initialize attribute of the following:
Class name: Student
Attribute: First Name
Last Name
Sex
Age
2. From the created class, create 5 objects, and display it using pretty table.
Triplet Sum
Given an array n integers, find and print all the unique triplets (a, b, c) in the array which give the sum K. (a+b+c=K).Input
The first line of the input will be space separated integers, denoting the elements of the array. The second line of the input will be an integer denoting the required sum KOutput
The output should be multiple lines, each line containing a unique triplet. The elements of the triple must be sorted in increasing order and all the triplets printed must be sorted in increasing order. Print "No Matching Triplets Found" if there are no triplets with the given sum.Explanation
Sample Input 1
0 12 17 8 9 21
29
Sample Output 1
(0, 8, 21)
(0, 12, 17)
(8, 9, 12)
Sample Input 2
0 1 2 3 5 7 13 17 19 19
22
Sample Output 2
(0, 3, 19)
(0, 5, 17)
(1, 2, 19)
(2, 3, 17)
(2, 7, 13)
Give me exact output of this question sir
Rotate Matrix Rings
Given a matrix of order M*N and a value K, write a program to rotate each ring of the matrix clockwise by K elements. If in any ring has less than or equal to K elements, then donβt rotate that ring.
Input
The first line of input will be two space-separated integers, denoting the M and N.
The next M lines will contain N space-separated integers.
The next line will contain an integer, denoting K.
Output
The output should be M*N matrix by rotating the matrix by K elements.
Explanation
Therefore, by rotating each ring in clockwise direction by 3 elements will give (13, 9, 5, 1, 2, 3, 4, 8, 12, 16, 15, 14) and (10, 6, 7, 11). So the output should be
4 8 12 16
3 10 6 15
2 7 11 14
1 5 9 13
Sample Input 1
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
3
Sample Output 1
13 9 5 1
14 7 11 2
15 6 10 3
16 12 8 4
Sample Input 2
3 4
1 2 3 4
10 11 12 5
9 8 7 6
2
Sample Output 2
9 10 1 2
8 11 12 3
7 6 5 4
give exact output this question