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

The manager of the company has informed his assistant to enter the age

of all the workers working in production department. Among all he has to

find the employee with maximum age employee. Help the manager to

find the maximum age employee by storing the all age of all employee in

1D array dynamically. Use functions to solve the task.

Input Format

19 21 22 23 18

Constraints

All numbers should be greater than 0.If constraints are not matched then

display "wrong input"

Output Format

23


#Let us import

#the math library

import cmath

#Create a class and call it calculator

class Calculator:

#define a method a call it trigonometry

def trigonometry(self):

print("Functions Menu")


print("j. asinh")


print("k. acosh")


print("l. atanh")


fun = input("Choose the function :")


if (fun == 'l' or fun == 'k' or fun == 'j'):


a = float(input("Enter the value :"))


dict6 = {'j': cmath.asinh(a), 'k': cmath.acosh(a), 'l': cmath.atanh(a)}


print("The result is : " + str(dict6.get(fun)))


else:

print("Wrong Choice")




# create a new object of Calculator class

my_calc = Calculator()


# Calling object's trigonometry() method

my_calc.trigonometry()


Question:

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


print ("Functions Menu")


Menu = ["asin","acos","atan","sinh","cosh","tanh"]


Option = ['d','e','f','g','h','i']


for r in range(0,len(Menu)):


print(Option[r],". ",Menu[r])




Flag=1


fun = ' '


while(Flag):


if(fun=='d' or fun=='e' or fun=='f' or fun=='g' or fun=='h' or fun=='i'):


Flag=0


else:


fun = input("Choose the function (d/e/f/g/h/i): ")




a = float(input("Enter the value :"))


dict4 = {'d':math.asin(a), 'e':math.acos(a), 'f':math.atan(a), 'g':math.sinh(a), 'h':math.cosh(a),'i':math.tanh(a)}


print ("The result is : " + Menu[ord(fun)-ord('d')]+"("+str(a)+") = "+str(dict4.get(fun)))



Question:


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

elif op == 7 or op == 8 or op == 9 or op == 10 or op == 11 or op == 12:

a = float(input("Enter the number"))

dict2 = {7: math.fabs(a), 8: math.factorial(a), 9: math.log(

a), 10: math.ceil(a), 11: math.floor(a), 12: math.sqrt(a)}

print("The result is : " + str(dict2.get(op)))

elif op == 13:

print("Functions Menu")

print("a. sin")

print("b. cos")

print("c. tan")



fun = input("Choose the function :")

a = float(input("Enter the angle in radians :"))

dict3 = {'a': math.sin(a), 'b': math.cos(a), 'c': math.tan(a)}

print("The result is : " + str(dict3.get(fun)))


Question:

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


if op == 5:

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

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

result = first % second

print("5. Modulus")

print(result)

if op == 6:

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

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

result = first ^ second

print("6. Exponentiation")

print(result)

else:

print("Please enter the value from 0 - 6")


op = int(input("Option (1 ... 13): "))



if op == 1 or op == 2 or op == 3 or op == 4 or op == 5 or op == 6:

a = int(input("Enter first number"))

b = int(input("Enter second number"))

dict1 = {1: a+b, 2: a-b, 3: a*b, 4: a/b, 5: a % b, 6: a**b}

print("The result is : " + str(dict1.get(op)))



Question:

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




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


LATEST TUTORIALS
APPROVED BY CLIENTS