Popular Posts

이은한. Powered by Blogger.

2022년 2월 15일 화요일

what is Python condition (if)


condition statement in Python

if Statement

  • Keyword: if, elif, else
  • if must there before use elif, else

if [condition] :
[space]code you want to run
elif [condition] :
[space]code you want to run
else :
[space]code you want to run

if Statement Example

a = 3
if a > 5:
    print("a is bigger than 5")
elif a > 0:
    print("a is bigger than 0 but smaller than 5")
else:
    print("a is negative")

0 개의 댓글:

댓글 쓰기