Python/Python Grammar

1. Python Basic, 파이썬 기본

DACHO 2021. 1. 31. 17:52
반응형

파이썬 공부를 시작했다.

파이썬이 다른 개발 언어들 보다 쉽다고 하는 걸 많이 들어봤지만

나는 sql이 더 직관적이고 쉽게 느껴지진다.

그런데 내가 아는 어느 개발자는 python이 더 쉽다고 했다. 사람마다 느끼는 게 다른 것 같다.

 

파이썬을 어디에 사용하는가?

파이썬을 사용하면 매우 쉽게 소프트웨어를 빌드할 수 있다.

덧붙여, 파이썬은 'versatile'한 언어라고 하는데 아래와 같은 상황에도 쓰일 수 있다. 

  • You want to do some quick calculations.

  • For your new business, you want to develop a database-driven website.

  • Your boss asks you to clean and analyze the results of the latest satisfaction survey.

 

print("HELLO WORLD")

print()는 기본 중의 기본!!

문자열(string) 산출을 위해서는 꼭 ' "를 붙여주기

 

 

매우 중요한 주석달기 #tag

코드를 설명하는 주석은 중요하다.

습관처럼 달아주어야 나중에 버그가 생겨도 해결하기 쉽다.

그리고 다른 사람이 나의 코드를 봤을 때, 설명 없이도 이해할 수 있으려면 주석은 필수다!

# Division <- 주석
print(5/8)          

 

파이썬 = 계산기 ?

  • [BASIC CALCULATION] addition+, subtraction-, multiplication* and division/
  • Exponentiation: **. This operator raises the number to its left to the power of the number to its right. For example 4**2 will give 16.
  • Modulo: %. This operator returns the remainder of the division of the number to the left by the number on its right. For example 18 % 7 equals 4.
#연이율 10%일 때, $100이 7년 뒤 가지는 가치는?
print(100*(1.1**7))

 

반응형