Complex Numbers
실수와 허수를 포함하고 있는 복소수
예를 들어, 1+3j 가 complex number 이다.
변수 이름 법칙
변수 이름은 영어 알파벳과 숫자 그리고 underscore (_) 으로만 구성될 수 있다. 변수 이름 첫글자는 알파벳이나 underscore로만 시작해야 합니다. 숫자로는 시작될 수 없다. 영어 알파벳은 대문자와 소문자가 구분이 된다.
올바른 변수 이름
name
_name
my_name
myName
잘못된 변수 이름
7name
my name
value를 setting해서 {}안에 글자 채우기.format(value)**
python = {'date': 1980, 'python_inventor': 'Guido van Rossum', 'location':'Centrum Wiskunde & Informatica','country':'Netherlands'}
print("""Python was conceived in the late {date}s by {python_inventor} at {location} (CWI) in the {country} as a successor to the ABC language (itself inspired by SETL), capable of exception handling and interfacing with the Amoeba operating system. Its implementation began in December 1989.""".format(**python))
나눗셈:
a = 10/3
나눗셈의 몫:
a = 10//3
나눗셈의 나머지:
a = 10%3
더하기:
num1 = 10
num1 += 1
print(num1)
빼기:
num1 = 10
num -=2
print(num1)
곱하기:
num1 = 10
num1 *= 2
print(num1)
나누기:
num1 = 10
num1 /= 2
print(num1)
10의 2승 구하기
10**2
홀수 짝수 구하기
if number %2 == 0:
print("짝수")
if number %2 == 1:
print("홀수")