Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте And, Or, Not Operators | Істина чи брехня?
Типи даних у Python
course content

Зміст курсу

Типи даних у Python

Типи даних у Python

1. Знайомство з числами в Python
2. Істина чи брехня?
3. Рядки
4. Поєднання всіх тем разом

book
And, Or, Not Operators

In real life, almost everyone expresses their thoughts using phrases like "Yes or No", "Definitely Not", "Yes, yes and yes!". Python language permits you to do almost the same, but it uses more formal phrases based on the statements and, or, and not.

X and Y can be any logical statement (True or False):

StatementSyntaxPurpose
andX and YReturns True only if X and Y are both True
orX or YReturns True in all cases, except if X and Y are both False
notnot XIf X is True, it changes it to False, and vice versa

Let's look at the table below to understand the logic of each operator:

XYX or YX and Ynot X
TrueTrueTrueTrueFalse
TrueFalseTrueFalseFalse
FalseTrueTrueFalseTrue
FalseFalseFalseFalseTrue
Завдання
test

Swipe to begin your solution

It's time for some tricky tasks!

Here, you should replace___ with a True or False statement to make:

  1. The statement1 variable equal to True.
  2. The statement2 variable equal to False.

Рішення

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

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

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

Секція 2. Розділ 3
toggle bottom row

book
And, Or, Not Operators

In real life, almost everyone expresses their thoughts using phrases like "Yes or No", "Definitely Not", "Yes, yes and yes!". Python language permits you to do almost the same, but it uses more formal phrases based on the statements and, or, and not.

X and Y can be any logical statement (True or False):

StatementSyntaxPurpose
andX and YReturns True only if X and Y are both True
orX or YReturns True in all cases, except if X and Y are both False
notnot XIf X is True, it changes it to False, and vice versa

Let's look at the table below to understand the logic of each operator:

XYX or YX and Ynot X
TrueTrueTrueTrueFalse
TrueFalseTrueFalseFalse
FalseTrueTrueFalseTrue
FalseFalseFalseFalseTrue
Завдання
test

Swipe to begin your solution

It's time for some tricky tasks!

Here, you should replace___ with a True or False statement to make:

  1. The statement1 variable equal to True.
  2. The statement2 variable equal to False.

Рішення

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

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

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

Секція 2. Розділ 3
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt