Python Quiz 12: Can You Guess the Output of this Python Code? | operators Quiz

preview_player
Показать описание
Welcome to another Python coding quiz! In this video, Python operators are used to perform operations on variables and values. The code uses three types of operators: arithmetic, exponentiation and floor division.

The ** operator is used for exponentiation, which means raising a number to a power. For example, 2 ** 3 means 2 raised to the power of 3, which is 8.

The // operator is used for floor division, which means dividing two numbers and rounding down the result to the nearest integer. For example, 4 // 2 means 4 divided by 2, which is 2.

The + and - operators are used for addition and subtraction, respectively. For example, 8 + 2 means 8 plus 2, which is 10.

The order of operations in Python follows the PEMDAS rule: parentheses, exponentiation, multiplication/division, addition/subtraction. So, the code is evaluated as follows:

2 ** 3 + 4 // 2 - 1
= (2 ** 3) + (4 // 2) - 1
= (8) + (2) - 1
= 10 - 1
= 9

The final result is 9.

If you enjoyed this video, please give it a thumbs up 👍and leave a comment 💬 below. Don't forget to subscribe 🔔to my channel for more Python tutorials like this one.

YouTube Playlists:

You can also follow me on:

Thanks for watching! 🙏**

#codingshorts #coding #pythonprogramming #codingshortvideo #python #pythonbasics #codinglife #yasirbhutta #pythontutorial
Комментарии
Автор

I got 9 as well but at least, you should have showed us how it's done

iyamaivan