[Python] 0. 도입

YJ·2024년 9월 14일

Python 공부하기

목록 보기
1/13
post-thumbnail

도입

이제 컴퓨터학부 4학년 재학중이다.

융합전공 이수학점을 목적으로 1학년 파이썬 과목을 수강하게 되어 글을 남기고자 한다.

물론 아는 내용이지만 얻어가는 것이 분명 있겠지..

Python 설치

Welcome to Python.org

  • 다운로드 메뉴에서 운영체제에 맞게 파이썬 설치

Hello World!

  • 무슨 언어든 처음 배우면하는 관례(?)인 “Hello World!” 출력
print("Hello World!")

import this

import this
  • 파이썬에서 Zen of Python이라는 철학적 가이드라인을 출력하는 명령
  • 파이썬 언어의 창시자인 팀 피터스(Tim Peters)가 작성한 글

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
(아름다운 것이 추한 것보다 낫다.)

Explicit is better than implicit.
(명시적인 것이 암시적인 것보다 낫다.)

Simple is better than complex.
(단순한 것이 복잡한 것보다 낫다.)

Complex is better than complicated.
(복잡한 것이 난해한 것보다 낫다.)

Flat is better than nested.
(평평한 것이 중첩된 것보다 낫다.)

Sparse is better than dense.
(여유로운 것이 빽빽한 것보다 낫다.)

Readability counts.
(가독성은 중요하다.)

Special cases aren't special enough to break the rules.
(특수한 경우도 규칙을 깨뜨릴 만큼 특별하지 않다.)

Although practicality beats purity.
(하지만 실용성이 순수성보다 우선이다.)

Errors should never pass silently.
(에러는 절대 조용히 넘어가서는 안 된다.)

Unless explicitly silenced.
(명시적으로 무시되는 경우는 제외다.)

In the face of ambiguity, refuse the temptation to guess.
(애매함에 직면했을 때는 추측하지 마라.)

There should be one-- and preferably only one --obvious way to do it.
(한 가지, 그리고 되도록이면 한 가지 방법만 있어야 한다.)

Although that way may not be obvious at first unless you're Dutch.
(그 방법은 처음에는 명확하지 않을 수도 있다. 당신이 네덜란드인이 아니라면.)

Now is better than never.
(지금이 결코 하지 않는 것보다 낫다.)

Although never is often better than right now.
(하지만 '지금 당장'보다는 '결코'가 더 나을 때도 있다.)

If the implementation is hard to explain, it's a bad idea.
(구현을 설명하기 어렵다면, 그것은 나쁜 아이디어다.)

If the implementation is easy to explain, it may be a good idea.
(구현을 설명하기 쉽다면, 그것은 좋은 아이디어일 가능성이 있다.)

Namespaces are one honking great idea -- let's do more of those!
(네임스페이스는 정말 훌륭한 아이디어다. 더 많이 사용하자!)

print("Hello World")
print("Do What You Love")
print("Wake Me Up When SeptemberEnds")
print("파이썬을 배우다.")

사칙 연산

print(22 + 45)
print(99 - 45)
print(108 * 108)
print(12 / 3)
profile
제 글이 유익하셨다면 ♡와 팔로우로 응원 부탁드립니다.

0개의 댓글