Skip to content

Commit aef15f7

Browse files
authored
Create 2.py
1 parent fc8b839 commit aef15f7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

11/2.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
str = input()
2+
3+
# 첫 번째 문자를 숫자로 변경하여 대입
4+
result = int(str[0])
5+
6+
for i in range(1, len(str)):
7+
# 두 수 중에서 하나라도 '0' 혹은 '1'인 경우, 곱하기보다는 더하기 수행
8+
if str[i] == '0' or str[i] == '1' or result <= 1:
9+
result += int(str[i])
10+
else:
11+
result *= int(str[i])
12+
13+
print(result)

0 commit comments

Comments
 (0)