Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Keywords: and, or, not | Boolean Type
Python Data Types

bookKeywords: and, or, not

There are some keywords for Boolean variables: and, or, not. They exist to create more complex expressions. Next we will see how it works with examples.

  • and. If value x = True and value y = True then x and y is equal to True. If either of those is False, then expression becomes False too.
  • or. If x = True or y = True then the expression x or y is equal to True (or both values = True).
  • not If value x is False then the expression, not x evaluates to True . Otherwise, the expression evaluates to False.
Input:
x, y = True, False
print((x or y) == False)

Output:
False
Input:
x, y = True, False
print((x and y) == False)

Output:
True
Input:
x = False
print(not x)

Output:
True
Завдання

Swipe to start coding

You must fill in the blanks so that the values ​​of all expressions satisfy the conditions specified in the comments.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 3
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

Awesome!

Completion rate improved to 3.85

bookKeywords: and, or, not

Свайпніть щоб показати меню

There are some keywords for Boolean variables: and, or, not. They exist to create more complex expressions. Next we will see how it works with examples.

  • and. If value x = True and value y = True then x and y is equal to True. If either of those is False, then expression becomes False too.
  • or. If x = True or y = True then the expression x or y is equal to True (or both values = True).
  • not If value x is False then the expression, not x evaluates to True . Otherwise, the expression evaluates to False.
Input:
x, y = True, False
print((x or y) == False)

Output:
False
Input:
x, y = True, False
print((x and y) == False)

Output:
True
Input:
x = False
print(not x)

Output:
True
Завдання

Swipe to start coding

You must fill in the blanks so that the values ​​of all expressions satisfy the conditions specified in the comments.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

close

Awesome!

Completion rate improved to 3.85
Секція 2. Розділ 3
single

single

some-alt