개발/python

#3.1 Else & elif_9월4일

규지니어스 2022. 9. 4. 11:50

 

password_correct = True

 

if password_correct:

print("Here is your money")

else:

print("Wrong password")

 

* print 는 2space나 tab을 꼭 주자

else는 선택사항이라 꼭 쓰지 않아도 된다.

 

elif

--------------------------------------

winner = 10

 

if winner > 10:

print("Winner is greater than 10")

elif winner < 10:

print("Winner is less than 10")

elif winner < 5:

print("Winner is less than 10")

else:

print("Winner is 10")

 

> Winner is 10

 


잘한 점: 블로그에 강의 들으며 작성한 걸 그대로 올리는 거지만,

강의도 들으며 따라서 잘 작성하고 있다 !

 

아쉬운 점: 분명 써먹을 수 있겠지? ㅋㅋㅋㅋㅋㅋ막연한 두려움...