Skip to content

Commit cd48dcd

Browse files
author
kim-yeji
committed
while문 1~3
1 parent 7747345 commit cd48dcd

32 files changed

+44
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Step/4) while문/10951.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# A+B -4
2+
3+
# try 블록 수행 중 오류가 발생하면
4+
# except 블록이 수행됨
5+
6+
while(True):
7+
try:
8+
a,b = map(int, input().split())
9+
print(a+b)
10+
except:
11+
break

Step/4) while문/10952.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# A+B -5
2+
3+
def plus(a,b):
4+
return a+b
5+
6+
a,b = map(int,input().split())
7+
8+
while(a!=0 and b!=0):
9+
print(plus(a,b))
10+
a,b = map(int,input().split())

Step/4) while문/1110.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 더하기 사이클
2+
3+
# new를 구한 후 비교하며 while 루프 돌리기
4+
# 불필요한 변수 줄이기
5+
6+
7+
n = int(input())
8+
cnt = 0
9+
new = n
10+
11+
while(True):
12+
n1 = int(new/10)
13+
n2 = new%10
14+
15+
p = n1+n2
16+
17+
new = (n2*10)+(p%10)
18+
cnt = cnt+1
19+
20+
if(new == n):
21+
break
22+
23+
print(cnt)

0 commit comments

Comments
 (0)