Skip to content
This repository was archived by the owner on Dec 1, 2022. It is now read-only.

Commit deb93b0

Browse files
authored
Update int(x,base).md
1 parent 7194678 commit deb93b0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

arrange/int(x,base).md

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33

44

5-
input example:<br>
6-
`3212 5`<br><br>
7-
output example:<br>
8-
`432`<br><br><br>
5+
input example:
6+
`3212 5`
7+
output example:
8+
`432`
99
위 예시는 '3212' 값을 가진 5진법 숫자를 10진법으로 출력한 내용이에요.<br><br>
1010
파이썬에 익숙하지 않다면(기능을 모르거나) 아래와 같이 코드가 나오겠어요!<br><br>
1111
```python
@@ -23,12 +23,12 @@ print(answer)
2323
### **보다 파이썬답게 작성한다면?<br><br>**
2424
int(x, base = 10) 형태로 진법 변환을 지원해요!<br>
2525
```python
26-
num = '3212'<br>
27-
base = 5<br>
28-
answer = int(num, base)<br>
29-
print(answer)<br><br>
26+
num = '3212'
27+
base = 5
28+
answer = int(num, base)
29+
print(answer)
3030
```
3131
코드가 아주 간단하면서 짧아지죠?<br><br>
3232
output:<br>
3333
`432`<br><br>
34-
원하는 결과가 정상적으로 출력되네요!<br><br>
34+
원하는 결과가 정상적으로 출력되네요!<br><br>

0 commit comments

Comments
 (0)