728x90
반응형

#python

 

점수를 받은 최고점수이다.

 

 

def solution(my_string):
    answer = 0
    tempList = []
    
    a = list((my_string.split(" ")))
    
    print(a)
    
    if a[0].isdigit() == True:
            tempList.append(int(a[0]))
            
    for i in range(1, len(a)):    
        if a[i].isdigit() == True:
            if a[i-1] == '-':
                tempList.append(int(a[i])*(-1))
            else :
                tempList.append(int(a[i]))
    
    answer = sum(tempList)
        
    return answer

 

 

728x90
반응형

+ Recent posts