PPaste!

Solutions to tekie python test

Home - All the pastes - Authored by Thooms

Raw version

 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
# Solution for question1 - second highest number

# py3

def LetMeDoIt(arr):
    # processing the input data to find result
    arr.remove(max(arr))
    return max(arr)

def MainApp():
    # taking input as a list of space separated integers
    arr = list(map(int, input().split()))

    result = LetMeDoIt(arr)
    print(result)
    
if __name__ == '__main__':
    MainApp()

# ==================================

# solution for question 2 

# py3

def LetMeDoIt(N):
    # processing the input data to find result
    if N > 1:
        if N == 2:
            return True
        for x in range(2, N):
            if N % x == 0:
                return False
            else:
                return True
    else:
        return False

def MainApp():
    # taking input number
    N = int(input())

    result = LetMeDoIt(N)
    print(result)
    
if __name__ == '__main__':
    MainApp()