- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the associativity of Python's ** operator?
From the Python docs:
Operators in the same box group left to right (except for comparisons), including tests, which all have the same precedence and chain from left to right — see section Comparisons — and exponentiation, which groups from right to left).
So the ** operator(exponentiation) is right to left associative. For example,
2 ** 3 ** 4 will be evaluated as: (2 ** (3 ** 4))
print(2 ** 3 ** 0)
This will give the output:
- What is C Operator Precedence and Associativity?
- What does 'is' operator do in Python?
- What does 'is not' operator do in Python?
- What is Python's OS Module
- What is Python's Sys Module
- What is the concept of Heinz's dilemma in Kohlberg's theory?
- Operator Precedence and Associativity in C
- What's the meaning of the phrase 'what you seek is seeking you'?
- What is the significance of Humayun's Tomb?
- What's the Kotlin equivalent of Java's String?
- What is Python equivalent of the ! operator?