Skip to content

Commit b87186c

Browse files
authored
Update 2.py
1 parent 2fd8fe2 commit b87186c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

11/2.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
str = input()
1+
data = input()
22

33
# 첫 번째 문자를 숫자로 변경하여 대입
4-
result = int(str[0])
4+
result = int(data[0])
55

6-
for i in range(1, len(str)):
6+
for i in range(1, len(data)):
77
# 두 수 중에서 하나라도 '0' 혹은 '1'인 경우, 곱하기보다는 더하기 수행
8-
if str[i] == '0' or str[i] == '1' or result <= 1:
9-
result += int(str[i])
8+
num = int(data[i])
9+
if num <= 1 or result <= 1:
10+
result += num
1011
else:
11-
result *= int(str[i])
12+
result *= num
1213

1314
print(result)

0 commit comments

Comments
 (0)