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

Зміст курсу

Типи даних у Python

Типи даних у Python

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

book
Priorities

When it comes to programming, being able to prioritize logical statements like and and or is crucial. Earlier, you worked with math operations such as + and *. You might remember from school that * has higher precedence than +. The same rule applies to logical operators — and takes priority over or.

Let's examine an example and make a guess about the result! If you're worried about making an error, feel free to check the hints in this chapter and refer to the table. Keep in mind that you should perform the action inside the brackets first!

12
statement = ((True or True) and False) or True print(statement)
copy

Let's break down this statement and look at each iteration to avoid any misunderstanding:

  1. ((True or True) and False) or True;
  2. (True and False) or True;
  3. False or True;
  4. True.
Завдання

Swipe to start coding

As an accountant, your goal is to ensure that all report checks return True. Replace each ___ with either True or False so that all variables equal True.

Рішення

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

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

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

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

book
Priorities

When it comes to programming, being able to prioritize logical statements like and and or is crucial. Earlier, you worked with math operations such as + and *. You might remember from school that * has higher precedence than +. The same rule applies to logical operators — and takes priority over or.

Let's examine an example and make a guess about the result! If you're worried about making an error, feel free to check the hints in this chapter and refer to the table. Keep in mind that you should perform the action inside the brackets first!

12
statement = ((True or True) and False) or True print(statement)
copy

Let's break down this statement and look at each iteration to avoid any misunderstanding:

  1. ((True or True) and False) or True;
  2. (True and False) or True;
  3. False or True;
  4. True.
Завдання

Swipe to start coding

As an accountant, your goal is to ensure that all report checks return True. Replace each ___ with either True or False so that all variables equal True.

Рішення

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

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

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

Секція 2. Розділ 7
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Ми дуже хвилюємося, що щось пішло не так. Що трапилося?
some-alt