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



if op == 0:


print("Thank you for using our calculator!")


if op == 1:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first + second


print("1. Addition")


print(result)


if op == 2:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first - second


print("2. Subtraction")


print(result)


if op == 3:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first / second


print("3. Multiplication")


print(result)


if op == 4:


first = int(input("Give the first value: "))


second = int(input("Give the second value: "))


result = first * second


print("4. Division")


print(result)



Question:


1. In this program, you are going to create a with getter and setter.

import math

print("MAIN MENU")

print("1. Addition")

print("2. Subtraction")

print("3. Multiplication")

print("4. Division")

print("5. Modulus")

print("6. Exponentiation")

print("7. Absolute value")

print("8. Factorial")

print("9. Logarithm")

print("10. Round Up")

print("11. Round Down")

print("12. Square Root")

print("13. Trigonometric Functions")

print("14. Inverse Trigonometric Functions")

print("15. Hyperbolic Functions")

print("16. Inverse Hyperbolic Functions")

print("")

print("NOTE: If you're performing operations in the 1-6 range, don't make the second number zero." )

print()



op = int(input("Enter the operation you want to perform : "))



Question:

1. In this program, you are going to create with getter and setter.


Suppose there is class of 10 students who have CGPA between 0-10. The university has decided to give the grace for those students those who have the CGPA between 4.5 to 4.9 to make it 5. Identify the students those have CGPA after adding the grace marks. Add the grace CGPA to the obtained CGPA of student through list comprehensions. Input Format- The input should contains an array of roll_no,and CGPA of the students. Constraints- CGPA must lies between 1.0 to 10.0 otherwise print "invalid input" Output Format- For each test case, display the roll_no and increased CGPA of those students only who lies between the obtained CGPA of 4.5-4.9


Trapezium Order


you are given an integer N . print N rows starting from 1 in the trapexium order as shown in the output of the below examples .


Input


the input contains an integer N


OUTPUT


the output should have N lines


each of the N lines should have space -seperated integers as per the trapezium order


SAMPLE INPUT 1


4


SAMPLE OUTPUT 1


1 2 3 4 17 18 19 20

5 6 7 14 15 16

8 9 12 13

10 11


Trapezium Order


you are given an integer N . print N rows starting from 1 in the trapexium order as shown in the output of the below examples .


Input


the input contains an integer N


OUTPUT


the output should have N lines


each of the N lines should have space -seperated integers as per the trapezium order


SAMPLE INPUT 1


4


SAMPLE OUTPUT 1


1 2 3 4 17 18 19 20

5 6 7 14 15 16

8 9 12 13

10 11


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.

LATEST TUTORIALS
APPROVED BY CLIENTS