1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-12 09:44:24 +02:00

[python/en] Adding exponentiation operator

This commit is contained in:
Andre Polykanine A.K.A. Menelion Elensúlë
2014-10-09 22:49:47 +03:00
parent ce3fb267f7
commit 39d8753d52
2 changed files with 8 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ language: python
contributors:
- ["Louie Dinh", "http://ldinh.ca"]
- ["Amin Bandali", "http://aminbandali.com"]
- "Andre Polykanine", "https://github.com/Oire"]
filename: learnpython.py
---
@@ -54,6 +55,9 @@ to Python 2.x. Look for another tour of Python 3 soon!
# Modulo operation
7 % 3 # => 1
# Exponentiation (x to the y'th power)
2 ** 4 # => 16
# Enforce precedence with parentheses
(1 + 3) * 2 # => 8