forked from AMC-IITBHU/Assignments-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwork.py
91 lines (78 loc) · 1.69 KB
/
work.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import math
import numpy as np
def demo(x):
'''
This is a demo function
Where in you just return square of the number
args:
x (int)
returns:
x*x (int)
'''
## Code Here
return None
def is_palindrome(string):
'''
This function returns True if the given string is
a Palindrome
args:
string (str)
returns:
flag (bool)
'''
## Code Here
return None
def sqrt_of_numbers(num):
'''
This function returns the magnitude of the square root of the number
args:
num (int) Need not be positive
returns:
sqroot (float)
'''
## Code Here
return None
def Maximum(arr):
'''
This function returns first maximum and the second maximum
number in the array
args:
arr (list)
returns:
Max1, Max2 (int, int)
'''
## Code Here
return None
def even_sort(arr):
'''
This function sorts the array giving higher preference to even numbers
args:
arr (list)
returns:
sort_arr (list)
ex:
arr = [15, 2, 6, 88, 7]
## then
sort_arr = [2, 6, 88 ,7 ,15]
## This is any even number is smaller than any odd number
'''
## Code Here
return None
def eqn_solver(A, B, C):
'''
This function solves a two variable system
i.e.,
A = [ 1, 2 ]
B = [ 3, 4 ]
C = [ 5, 6 ]
then it means
1x + 3y = 5
2x + 4y = 6
Hence you are required to find x, y for such a linear system
args:
A, B, C (list, list, list) representing coefficients in the equation
returns:
x, y (float, float)
'''
## Code Here
return None