python

파이썬 기초문법

bumychoi 2024. 7. 3. 21:08

1. 네이밍

a=15
print(a)
_b=3.14
print(_b)
2c= int(77)
_7d=float(5.14)
print(_7d)

1.영문 문자와 숫자를 사용 가능

2. 대소문자를 구분

3. 문자부터 시작, 숫자는 불가

4._(언더스코어)가능

5. 특수문자(+,-,*,/,$,@,&,%) 불가

 

2. 

x= 15
y= 25

print(f'x==y:{x==y}')
print(f'x is y : {x is y}')

x==y:False 값비교
x is y : False 

 

x= ['orange','banana','apple']
y= x
print(f'x==y:{x==y}')
print(f'x is y:{x is y}')

x==y:True
x is y:True

 

3.

x=["orange","banana","apple"]
y=["orange","banana","apple"]
print(f'x==y:{x==y}')
print(f'x is y:{x is y}')

x==y:True
x is y:False

 

is , not is ->참조, 객제를 비교

= , !=  값을 비교

 

 

4.

c=[]
d=c
e=c+d
print(c==d)
print(c is d)
print(c==e)
print(c is e)

True
True
True
False