비교 연산자

MATLAB 사용자를 위한 Python

Justin Kiggins

Product Manager

비교 연산자 사용

value = 0.967
threshold = 0.85

meets_criteria = value > threshold

print(meets_criteria)
True
MATLAB 사용자를 위한 Python

비교 연산자 목록

비교 Python MATLAB
같다 == ==
같지 않다 != ~=
작다 < <
작거나 같다 <= <=
크다 > >
크거나 같다 >= >=
MATLAB 사용자를 위한 Python

If

value = 0.967
threshold = 0.85

meets_criteria = value > threshold

if meets_criteria: print('PASS')
PASS
MATLAB 사용자를 위한 Python

Else

value = 0.275
threshold = 0.85

meets_criteria = value > threshold

if meets_criteria: print('PASS') else: print('FAIL')
FAIL
MATLAB 사용자를 위한 Python

Else if

porridge_temperature = 74.6

if porridge_temperature > 130: print('Too hot! :(') elif porridge_temperature < 110: print('Too cold! :(') else: print('Just right :D')
Too cold! :(
MATLAB 사용자를 위한 Python

연습해 봅시다

MATLAB 사용자를 위한 Python

Preparing Video For Download...