We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2fd8fe2 commit b87186cCopy full SHA for b87186c
11/2.py
@@ -1,13 +1,14 @@
1
-str = input()
+data = input()
2
3
# 첫 번째 문자를 숫자로 변경하여 대입
4
-result = int(str[0])
+result = int(data[0])
5
6
-for i in range(1, len(str)):
+for i in range(1, len(data)):
7
# 두 수 중에서 하나라도 '0' 혹은 '1'인 경우, 곱하기보다는 더하기 수행
8
- if str[i] == '0' or str[i] == '1' or result <= 1:
9
- result += int(str[i])
+ num = int(data[i])
+ if num <= 1 or result <= 1:
10
+ result += num
11
else:
- result *= int(str[i])
12
+ result *= num
13
14
print(result)
0 commit comments