Boolean data type
Another data type in Python - is boolean, or logical. It can take only 2 values - True or False or in terms of numbers 1 or 0 respectively. This data type is used when we need to check some logical condition and depends on that continue.
There are next logical operators you can use in comparison:
==
equal!=
not equal>
greater than<
less than>=
greater-equal than<=
less-equal than
While using these operators you will receive output as a boolean value: True if the condition holds or False otherwise. For example, let's check some expressions
123456# check if 1 equals True print(1 == True) # check if "abc" equals "aBc" print("abc" == 'aBc') # check if 87*731 greater equal than 98*712 print(87*731 >= 98*712)
Swipe to start coding
Check the following statements and print the respective result
- Is 2 not equal to False?
- Is 982*37 greater than 354*98?
- Is string "abcd" greater than "abc"?
Oplossing
Bedankt voor je feedback!
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Awesome!
Completion rate improved to 2.33Awesome!
Completion rate improved to 2.33
Boolean data type
Another data type in Python - is boolean, or logical. It can take only 2 values - True or False or in terms of numbers 1 or 0 respectively. This data type is used when we need to check some logical condition and depends on that continue.
There are next logical operators you can use in comparison:
==
equal!=
not equal>
greater than<
less than>=
greater-equal than<=
less-equal than
While using these operators you will receive output as a boolean value: True if the condition holds or False otherwise. For example, let's check some expressions
123456# check if 1 equals True print(1 == True) # check if "abc" equals "aBc" print("abc" == 'aBc') # check if 87*731 greater equal than 98*712 print(87*731 >= 98*712)
Swipe to start coding
Check the following statements and print the respective result
- Is 2 not equal to False?
- Is 982*37 greater than 354*98?
- Is string "abcd" greater than "abc"?
Oplossing
Bedankt voor je feedback!
single
Awesome!
Completion rate improved to 2.33
Boolean data type
Veeg om het menu te tonen
Another data type in Python - is boolean, or logical. It can take only 2 values - True or False or in terms of numbers 1 or 0 respectively. This data type is used when we need to check some logical condition and depends on that continue.
There are next logical operators you can use in comparison:
==
equal!=
not equal>
greater than<
less than>=
greater-equal than<=
less-equal than
While using these operators you will receive output as a boolean value: True if the condition holds or False otherwise. For example, let's check some expressions
123456# check if 1 equals True print(1 == True) # check if "abc" equals "aBc" print("abc" == 'aBc') # check if 87*731 greater equal than 98*712 print(87*731 >= 98*712)
Swipe to start coding
Check the following statements and print the respective result
- Is 2 not equal to False?
- Is 982*37 greater than 354*98?
- Is string "abcd" greater than "abc"?
Oplossing
Bedankt voor je feedback!