파이썬 코딩도장 #변수와 입력 사용하기 #6.6 연습문제 #6.7 심사문제 #6.8 심사문제
-
3. 변수와 입력 사용하기Python/Grammar 2022. 11. 29. 12:56
# 1. 변수 만들기 파이썬에서는 변수를 만들기 위해 '=(assignment operator: 할당연산자)' 을 사용해 값에 변수를 할당하며, 변수 이름을 지정할 때는 다음과 같은 규칙을 따라야 한다. 💡 변수 naming 규칙 - 영문 문자와 숫자를 사용할 수 있다. - 대소문자를 구분한다. - 문자부터 시작해야 하며 숫자부터 시작하면 안 된다. - _(밑줄 문자)로 시작할 수 있다. - 특수 문자(+, -, *, /, $, @, &, % 등)는 사용할 수 없다. - 파이썬의 키워드(if, for, while, and, or 등)는 사용할 수 없다. 1-1. 변수의 자료형 알아내기 type(변수) >>> x = 100 >>> type(x) >>> y = 'Hello, Python!' >>> type(..