본문 바로가기
  • AI (Artificial Intelligence)
Industry 4.0/Python

How to set python variables to true or false?

by 로샤스 2021. 4. 7.

Ref. stackoverflow.com/questions/12644075/how-to-set-python-variables-to-true-or-false

you set a variable to true or false by assigning True or False to it:

myFirstVar = True
myOtherVar = False

If you have a condition that is basically like this though:

if <condition>: 
	var = True 
else: 
	var = False

then it is much easier to simply assign the result of the condition directly:

var = <condition>

In your case:

match_var = a == b

 

 

 

 

댓글