@VishalChoudhary/

RevolvingMenacingNotification

Python

No description

fork
loading
Files
  • main.py
main.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
def Output(N,R,C,Sr,Sc,I): 
    """outputs"""
    G = [[0 for col in range(C)] for row in range(R)]

    G[Sr-1][Sc-1] = 1
    Tr = Sr-1
    Tc = Sc-1
    
    
    for i in I:
        if(i == "N"):
            while(G[Tr][Tc] == 1):
                Tr = Tr - 1
            
            G[Tr][Tc] = 1
            
        
        elif(i == "E"):
           
            while(G[Tr][Tc] == 1):
                Tc = Tc + 1
            
            G[Tr][Tc] = 1
            
        
        elif(i == "S"):
            while(G[Tr][Tc] == 1):
                Tr = Tr + 1
            
            G[Tr][Tc] = 1
            
    
        elif(i == "W"):
            while(G[Tr][Tc] == 1):
                Tc = Tc - 1
            
            G[Tr][Tc] = 1
            
    
    Output = "Case #"+ str(1) + " : " + str(Tr+1) + " "+ str(Tc+1)
    
    return Output

print(Output(5,3,6,2,3,"EEWNS"))