given a integer valun N as input, write a program to print a shaded diamond of 2*N-1 rows using astherisk(*) character..
write a program to implement reversal of a string using stack data structure
Let A be an array of size n. Choose the first value as pivot. Write a program to partition the array based on the pivot value so that all values to
the left of pivot are lesser and right of pivot are greater than the pivot.For example, if A = [60, 67, 34, 23, 32, 54, 76] is the input, the output has to be A =[23, 54, 34, 32, 60, 67, 76]. Since 60 is the pivot, left of 60 are lesser than 60 and the right values are greater than 60
write a program in Python to store the name of five cities list create a function search name to search city using Linear search if the required name was and name it is not available the function should return -1
Write a program to convert a fraction to a decimal. Have your program ask for the numerator first, then denominator. Make sure to check if the denominator is zero.
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.